diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/CheckIrElementVisitor.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/CheckIrElementVisitor.kt index f51f5fe34fd..e2a4acd5d27 100644 --- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/CheckIrElementVisitor.kt +++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/CheckIrElementVisitor.kt @@ -90,6 +90,7 @@ class CheckIrElementVisitor( override fun visitConst(expression: IrConst) { super.visitConst(expression) + @Suppress("UNUSED_VARIABLE") val naturalType = when (expression.kind) { IrConstKind.Null -> { expression.ensureNullable() @@ -106,9 +107,9 @@ class CheckIrElementVisitor( IrConstKind.Double -> irBuiltIns.doubleType } - var type = expression.type /* TODO: This check used to have JS inline class helpers. Rewrite it in a common way. + var type = expression.type while (true) { val inlinedClass = type.getInlinedClass() ?: break if (getInlineClassUnderlyingType(inlinedClass) == type) diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/InlineClassDeclarationLowering.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/InlineClassDeclarationLowering.kt index e50f65d456c..5c8c782a254 100644 --- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/InlineClassDeclarationLowering.kt +++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/InlineClassDeclarationLowering.kt @@ -272,10 +272,9 @@ class InlineClassLowering(val context: CommonBackendContext) { } private fun IrFunction.toInlineClassImplementationName(): Name { - val klass = this.parentAsClass!! - val newName = klass.name.asString() + "__" + name.asString() + INLINE_CLASS_IMPL_SUFFIX + val newName = parentAsClass.name.asString() + "__" + name.asString() + INLINE_CLASS_IMPL_SUFFIX return when { - name.isSpecial -> Name.special("<" + newName + ">") + name.isSpecial -> Name.special("<$newName>") else -> Name.identifier(newName) } } diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/EnumClassLowering.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/EnumClassLowering.kt index 444cd604f9f..ba5e2abb355 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/EnumClassLowering.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/EnumClassLowering.kt @@ -41,12 +41,12 @@ class EnumUsageLowering(val context: JsCommonBackendContext) : BodyLoweringPass val enumEntry = expression.symbol.owner val klass = enumEntry.parent as IrClass if (klass.isExternal) return expression - return lowerEnumEntry(enumEntry, klass) + return lowerEnumEntry(enumEntry) } }) } - private fun lowerEnumEntry(enumEntry: IrEnumEntry, klass: IrClass) = + private fun lowerEnumEntry(enumEntry: IrEnumEntry) = enumEntry.getInstanceFun!!.run { JsIrBuilder.buildCall(symbol) } } diff --git a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/lower/EraseVirtualDispatchReceiverParametersTypes.kt b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/lower/EraseVirtualDispatchReceiverParametersTypes.kt index cca0d770e93..0d35ca81db3 100644 --- a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/lower/EraseVirtualDispatchReceiverParametersTypes.kt +++ b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/lower/EraseVirtualDispatchReceiverParametersTypes.kt @@ -48,8 +48,8 @@ import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid * Related issue: [https://github.com/WebAssembly/gc/issues/29] */ class EraseVirtualDispatchReceiverParametersTypes(val context: CommonBackendContext) : FileLoweringPass { - override fun lower(file: IrFile) { - file.acceptChildrenVoid(object : IrElementVisitorVoid { + override fun lower(irFile: IrFile) { + irFile.acceptChildrenVoid(object : IrElementVisitorVoid { override fun visitElement(element: IrElement) { element.acceptChildrenVoid(this) } @@ -88,4 +88,4 @@ class EraseVirtualDispatchReceiverParametersTypes(val context: CommonBackendCont } }) } -} \ No newline at end of file +} diff --git a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/lower/WasmTypeOperatorLowering.kt b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/lower/WasmTypeOperatorLowering.kt index 96b01eb139a..d567cbb98ef 100644 --- a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/lower/WasmTypeOperatorLowering.kt +++ b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/lower/WasmTypeOperatorLowering.kt @@ -185,15 +185,15 @@ class WasmBaseTypeOperatorTransformer(val context: WasmBackendContext) : IrEleme // Handling null manually if (toType.isNullable() && fromType.isNullable()) { return builder.irComposite { - val value = cacheValue(value) + val cachedValue = cacheValue(value) +builder.irIfNull( type = toType, - subject = value() as IrExpression, + subject = cachedValue() as IrExpression, thenPart = builder.irNull(toType), elsePart = builder.irCall(symbols.wasmRefCast, type = toType).apply { putTypeArgument(0, fromType) putTypeArgument(1, toType) - putValueArgument(0, value() as IrExpression) + putValueArgument(0, cachedValue() as IrExpression) } ) } diff --git a/js/js.tests/build.gradle.kts b/js/js.tests/build.gradle.kts index a79d7594555..1c859531e88 100644 --- a/js/js.tests/build.gradle.kts +++ b/js/js.tests/build.gradle.kts @@ -291,7 +291,6 @@ projectTest("wasmTest", true) { include("org/jetbrains/kotlin/js/test/wasm/semantics/*") val jsShellExecutablePath = File(unzipJsShell.get().destinationDir, "js").absolutePath val v8ExecutablePath = File(unzipV8.get().destinationDir, "d8").absolutePath - println(v8ExecutablePath) systemProperty("javascript.engine.path.SpiderMonkey", jsShellExecutablePath) systemProperty("javascript.engine.path.V8", v8ExecutablePath) diff --git a/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/WasmExpressionBuilder.kt b/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/WasmExpressionBuilder.kt index 26d5fb7dea2..15d3f1e5d41 100644 --- a/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/WasmExpressionBuilder.kt +++ b/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/WasmExpressionBuilder.kt @@ -39,16 +39,19 @@ abstract class WasmExpressionBuilder { buildInstr(WasmOp.UNREACHABLE) } + @Suppress("UNUSED_PARAMETER") fun buildBlock(label: String?, resultType: WasmType? = null) { numberOfNestedBlocks++ buildInstr(WasmOp.BLOCK, WasmImmediate.BlockType.Value(resultType)) } + @Suppress("UNUSED_PARAMETER") fun buildLoop(label: String?, resultType: WasmType? = null) { numberOfNestedBlocks++ buildInstr(WasmOp.LOOP, WasmImmediate.BlockType.Value(resultType)) } + @Suppress("UNUSED_PARAMETER") fun buildIf(label: String?, resultType: WasmType? = null) { numberOfNestedBlocks++ buildInstr(WasmOp.IF, WasmImmediate.BlockType.Value(resultType)) diff --git a/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/convertors/WasmIrToBinary.kt b/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/convertors/WasmIrToBinary.kt index de4a563c981..1c289091d66 100644 --- a/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/convertors/WasmIrToBinary.kt +++ b/wasm/wasm.ir/src/org/jetbrains/kotlin/wasm/ir/convertors/WasmIrToBinary.kt @@ -460,6 +460,7 @@ abstract class ByteWriter { private fun writeUnsignedLeb128(v: UInt) { // Taken from Android source, Apache licensed + @Suppress("NAME_SHADOWING") var v = v var remaining = v shr 7 while (remaining != 0u) { @@ -474,6 +475,7 @@ abstract class ByteWriter { private fun writeSignedLeb128(v: Long) { // Taken from Android source, Apache licensed + @Suppress("NAME_SHADOWING") var v = v var remaining = v shr 7 var hasMore = true @@ -508,4 +510,4 @@ abstract class ByteWriter { override fun createTemp() = OutputStream(ByteArrayOutputStream()) } -} \ No newline at end of file +}