You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Looks like the kotlinx.io.core.String(ByteArray, Int, Int, Charset) function just ignores the length and offset arguments on JS.
For example, the String(byteArrayOf(64, 64, 67, 67), length = 2, offset = 1) expression will return @@CC instead of @C.
Steps to Reproduce:
Create a new Kotlin/JavaScript + Gradle project using IntelliJ IDEA.
Make the build.gradle file look like that:
plugins {
id 'java'
id 'kotlin2js' version '1.3.20-dev-592'
}
group 'com.company.test'
version '1.0-SNAPSHOT'
sourceCompatibility =1.8
repositories {
jcenter()
maven { url 'http://dl.bintray.com/kotlin/kotlin-dev' }
maven { url 'http://dl.bintray.com/kotlin/kotlinx' }
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-js"
compile "org.jetbrains.kotlin:kotlin-test-js"
compile "org.jetbrains.kotlinx:kotlinx-io-js:0.1.0-alpha-17-rc13"
}
compileKotlin2Js {
kotlinOptions.moduleKind ='umd'
}
Looks like an array returned by the TypedArray#subarray(...) method uses the same buffer as the original array: The subarray() method returns a new TypedArray on the same ArrayBuffer store and with the same element types as for this TypedArray object. So, i8.subarray(offset, offset + length).buffer will return the original ArrayBuffer and will ignore the offset and length parameters :/.
We're rebooting the kotlinx-io development (see #131), all issues related to the previous versions will be closed. Consider reopening it if the issue remains (or the feature is still missing) in a new version.
Description
Looks like the
kotlinx.io.core.String(ByteArray, Int, Int, Charset)
function just ignores thelength
andoffset
arguments on JS.For example, the
String(byteArrayOf(64, 64, 67, 67), length = 2, offset = 1)
expression will return@@CC
instead of@C
.Steps to Reproduce:
build.gradle
file look like that:settings.gradle
file look like that:@@CC
will be printed instead of@C
😞.The text was updated successfully, but these errors were encountered: