diff --git a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/lower/WasmVarargExpressionLowering.kt b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/lower/WasmVarargExpressionLowering.kt index 953eb51dd57..02ddd368824 100644 --- a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/lower/WasmVarargExpressionLowering.kt +++ b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/lower/WasmVarargExpressionLowering.kt @@ -12,6 +12,7 @@ import org.jetbrains.kotlin.backend.common.lower.createIrBuilder import org.jetbrains.kotlin.backend.common.lower.irComposite import org.jetbrains.kotlin.backend.wasm.WasmBackendContext import org.jetbrains.kotlin.ir.builders.* +import org.jetbrains.kotlin.ir.declarations.IrConstructor import org.jetbrains.kotlin.ir.declarations.IrFile import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction import org.jetbrains.kotlin.ir.declarations.IrVariable @@ -40,8 +41,15 @@ internal class WasmVarargExpressionLowering( check(arrayClass.symbol in context.wasmSymbols.arrays) { "Argument ${ir2string(arrayClass)} must be an array" } } - val primaryConstructor - get() = arrayClass.primaryConstructor!! + val isUnsigned + get() = arrayClass.symbol in context.wasmSymbols.unsignedTypesToUnsignedArrays.values + + val primaryConstructor: IrConstructor + get() { + if (isUnsigned) + return arrayClass.constructors.find { it.valueParameters.singleOrNull()?.type == context.irBuiltIns.intType }!! + return arrayClass.primaryConstructor!! + } val constructors get() = arrayClass.constructors diff --git a/compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArray.kt b/compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArray.kt index 019e9634993..24b6ddb219c 100644 --- a/compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArray.kt +++ b/compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArray.kt @@ -1,5 +1,4 @@ // WITH_RUNTIME -// IGNORE_BACKEND: WASM fun test(uis: UIntArray): String { var s = "" diff --git a/compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayIndices.kt b/compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayIndices.kt index 9beda562b42..d156f6653d8 100644 --- a/compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayIndices.kt +++ b/compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayIndices.kt @@ -1,5 +1,4 @@ // WITH_RUNTIME -// IGNORE_BACKEND: WASM fun test(uis: UIntArray): String { var s = "" diff --git a/compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayIndicesReversed.kt b/compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayIndicesReversed.kt index 618df355b12..e5ae82430fd 100644 --- a/compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayIndicesReversed.kt +++ b/compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayIndicesReversed.kt @@ -1,5 +1,4 @@ // WITH_RUNTIME -// IGNORE_BACKEND: WASM fun test(uis: UIntArray): String { var s = "" diff --git a/compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayReversed.kt b/compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayReversed.kt index 9170f1a5fd4..103dbefaee8 100644 --- a/compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayReversed.kt +++ b/compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayReversed.kt @@ -1,5 +1,4 @@ // WITH_RUNTIME -// IGNORE_BACKEND: WASM fun test(uis: UIntArray): String { var s = "" diff --git a/compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayWithIndex.kt b/compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayWithIndex.kt index 0b2fd4c55da..5bf973f89af 100644 --- a/compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayWithIndex.kt +++ b/compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayWithIndex.kt @@ -1,5 +1,4 @@ // WITH_RUNTIME -// IGNORE_BACKEND: WASM fun test(uis: UIntArray): String { var s = "" diff --git a/compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayWithIndexNoElementVar.kt b/compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayWithIndexNoElementVar.kt index bfbed07471a..9373ff186c9 100644 --- a/compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayWithIndexNoElementVar.kt +++ b/compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayWithIndexNoElementVar.kt @@ -1,5 +1,4 @@ // WITH_RUNTIME -// IGNORE_BACKEND: WASM fun test(uis: UIntArray): String { var s = "" diff --git a/compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayWithIndexNoIndexVar.kt b/compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayWithIndexNoIndexVar.kt index 36e3d8f2958..9372e73e29a 100644 --- a/compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayWithIndexNoIndexVar.kt +++ b/compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayWithIndexNoIndexVar.kt @@ -1,5 +1,4 @@ // WITH_RUNTIME -// IGNORE_BACKEND: WASM fun test(uis: UIntArray): String { var s = "" diff --git a/compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayWithIndexReversed.kt b/compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayWithIndexReversed.kt index 3e8560ad37c..8bad1d8fa73 100644 --- a/compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayWithIndexReversed.kt +++ b/compiler/testData/codegen/box/arrays/forInUnsignedArray/forInUnsignedArrayWithIndexReversed.kt @@ -1,5 +1,4 @@ // WITH_RUNTIME -// IGNORE_BACKEND: WASM fun test(uis: UIntArray): String { var s = "" diff --git a/compiler/testData/codegen/box/controlStructures/forInArray/forInInlineClassArrayWithUpcast.kt b/compiler/testData/codegen/box/controlStructures/forInArray/forInInlineClassArrayWithUpcast.kt index 7c9e23d714d..cb01285f58c 100644 --- a/compiler/testData/codegen/box/controlStructures/forInArray/forInInlineClassArrayWithUpcast.kt +++ b/compiler/testData/codegen/box/controlStructures/forInArray/forInInlineClassArrayWithUpcast.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND: WASM -// WASM_MUTE_REASON: UNSIGNED_ARRAYS // !LANGUAGE: +InlineClasses // WITH_RUNTIME diff --git a/compiler/testData/codegen/box/inlineClasses/hiddenConstructor/kt28855.kt b/compiler/testData/codegen/box/inlineClasses/hiddenConstructor/kt28855.kt index e92a659ed1d..2193dfc2dcc 100644 --- a/compiler/testData/codegen/box/inlineClasses/hiddenConstructor/kt28855.kt +++ b/compiler/testData/codegen/box/inlineClasses/hiddenConstructor/kt28855.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND: WASM -// WASM_MUTE_REASON: UNSIGNED_ARRAYS // WITH_RUNTIME class C(val x: T, vararg ys: UInt) { diff --git a/compiler/testData/codegen/box/inlineClasses/multifileClass.kt b/compiler/testData/codegen/box/inlineClasses/multifileClass.kt index 314b7a76689..c447a64676c 100644 --- a/compiler/testData/codegen/box/inlineClasses/multifileClass.kt +++ b/compiler/testData/codegen/box/inlineClasses/multifileClass.kt @@ -1,5 +1,4 @@ // WITH_RUNTIME -// IGNORE_BACKEND: WASM fun box(): String { val uia = uintArrayOf() diff --git a/compiler/testData/codegen/box/unsignedTypes/iterateOverArrayOfUnsignedValues.kt b/compiler/testData/codegen/box/unsignedTypes/iterateOverArrayOfUnsignedValues.kt index 45a8fc29497..6afa7243295 100644 --- a/compiler/testData/codegen/box/unsignedTypes/iterateOverArrayOfUnsignedValues.kt +++ b/compiler/testData/codegen/box/unsignedTypes/iterateOverArrayOfUnsignedValues.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND: WASM -// WASM_MUTE_REASON: UNSIGNED_ARRAYS // WITH_RUNTIME fun box(): String { diff --git a/compiler/testData/codegen/box/unsignedTypes/unsignedArraySize.kt b/compiler/testData/codegen/box/unsignedTypes/unsignedArraySize.kt index d1c1c4c0b3d..9be1d853537 100644 --- a/compiler/testData/codegen/box/unsignedTypes/unsignedArraySize.kt +++ b/compiler/testData/codegen/box/unsignedTypes/unsignedArraySize.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND: WASM -// WASM_MUTE_REASON: UNSIGNED_ARRAYS // WITH_RUNTIME fun test() = uintArrayOf(1u).size diff --git a/compiler/testData/codegen/box/unsignedTypes/varargsOfUnsignedTypes.kt b/compiler/testData/codegen/box/unsignedTypes/varargsOfUnsignedTypes.kt index 4ff7626fb19..1623b3d90ac 100644 --- a/compiler/testData/codegen/box/unsignedTypes/varargsOfUnsignedTypes.kt +++ b/compiler/testData/codegen/box/unsignedTypes/varargsOfUnsignedTypes.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND: WASM -// WASM_MUTE_REASON: UNSIGNED_ARRAYS // WITH_RUNTIME fun uint(vararg us: UInt): UIntArray = us