diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/ir/IrUtils.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/ir/IrUtils.kt index 80abbb1606e..5015f5b58f4 100644 --- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/ir/IrUtils.kt +++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/ir/IrUtils.kt @@ -171,6 +171,7 @@ fun IrValueParameter.copyTo( ).also { descriptor.bind(it) it.parent = irFunction + it.defaultValue = defaultValue } } diff --git a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/DefaultArgumentStubGenerator.kt b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/DefaultArgumentStubGenerator.kt index 9cfba752a95..9b14e650512 100644 --- a/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/DefaultArgumentStubGenerator.kt +++ b/compiler/ir/backend.common/src/org/jetbrains/kotlin/backend/common/lower/DefaultArgumentStubGenerator.kt @@ -50,7 +50,6 @@ open class DefaultArgumentStubGenerator constructor(val context: CommonBackendCo else null } - } private val symbols = context.ir.symbols @@ -64,91 +63,91 @@ open class DefaultArgumentStubGenerator constructor(val context: CommonBackendCo log { "detected ${irFunction.name.asString()} has got #${bodies.size} default expressions" } - if (bodies.isNotEmpty()) { - - val newIrFunction = irFunction.generateDefaultsFunction(context) - newIrFunction.parent = irFunction.parent - - log { "$irFunction -> $newIrFunction" } - val builder = context.createIrBuilder(newIrFunction.symbol) - - newIrFunction.body = builder.irBlockBody(newIrFunction) { - val params = mutableListOf() - val variables = mutableMapOf() - - irFunction.dispatchReceiverParameter?.let { - variables[it] = newIrFunction.dispatchReceiverParameter!! - } - - irFunction.extensionReceiverParameter?.let { - variables[it] = newIrFunction.extensionReceiverParameter!! - } - - for (valueParameter in irFunction.valueParameters) { - val parameter = newIrFunction.valueParameters[valueParameter.index] - - val argument = if (valueParameter.defaultValue != null) { - val kIntAnd = symbols.intAnd.owner - val condition = irNotEquals(irCall(kIntAnd).apply { - dispatchReceiver = irGet(maskParameter(newIrFunction, valueParameter.index / 32)) - putValueArgument(0, irInt(1 shl (valueParameter.index % 32))) - }, irInt(0)) - - val expressionBody = valueParameter.defaultValue!! - - expressionBody.transformChildrenVoid(object : IrElementTransformerVoid() { - override fun visitGetValue(expression: IrGetValue): IrExpression { - log { "GetValue: ${expression.symbol.owner}" } - val valueSymbol = variables[expression.symbol.owner] ?: return expression - return irGet(valueSymbol) - } - }) - - irIfThenElse( - type = parameter.type, - condition = condition, - thenPart = expressionBody.expression, - elsePart = irGet(parameter) - ) - } else { - irGet(parameter) - } - - val temporaryVariable = irTemporary(argument, nameHint = parameter.name.asString()) - - params.add(temporaryVariable) - variables[valueParameter] = temporaryVariable - } - - if (irFunction is IrConstructor) { - +IrDelegatingConstructorCallImpl( - startOffset = irFunction.startOffset, - endOffset = irFunction.endOffset, - type = context.irBuiltIns.unitType, - symbol = irFunction.symbol, descriptor = irFunction.symbol.descriptor, - typeArgumentsCount = irFunction.typeParameters.size - ).apply { - dispatchReceiver = newIrFunction.dispatchReceiverParameter?.let { irGet(it) } - - params.forEachIndexed { i, variable -> putValueArgument(i, irGet(variable)) } - } - } else { - +irReturn(irCall(irFunction).apply { - dispatchReceiver = newIrFunction.dispatchReceiverParameter?.let { irGet(it) } - extensionReceiver = newIrFunction.extensionReceiverParameter?.let { irGet(it) } - - params.forEachIndexed { i, variable -> putValueArgument(i, irGet(variable)) } - }) - } - } - // Remove default argument initializers. - irFunction.valueParameters.forEach { - it.defaultValue = IrExpressionBodyImpl(IrErrorExpressionImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, it.type, "Default Stub")) - } - + if (bodies.isEmpty()) { + // Fake override + val newIrFunction = irFunction.generateDefaultsFunction(context, IrDeclarationOrigin.FAKE_OVERRIDE) return listOf(irFunction, newIrFunction) } - return listOf(irFunction) + + val newIrFunction = irFunction.generateDefaultsFunction(context, DECLARATION_ORIGIN_FUNCTION_FOR_DEFAULT_PARAMETER) + + log { "$irFunction -> $newIrFunction" } + val builder = context.createIrBuilder(newIrFunction.symbol) + + newIrFunction.body = builder.irBlockBody(newIrFunction) { + val params = mutableListOf() + val variables = mutableMapOf() + + irFunction.dispatchReceiverParameter?.let { + variables[it] = newIrFunction.dispatchReceiverParameter!! + } + + irFunction.extensionReceiverParameter?.let { + variables[it] = newIrFunction.extensionReceiverParameter!! + } + + for (valueParameter in irFunction.valueParameters) { + val parameter = newIrFunction.valueParameters[valueParameter.index] + + val argument = if (valueParameter.defaultValue != null) { + val kIntAnd = symbols.intAnd.owner + val condition = irNotEquals(irCall(kIntAnd).apply { + dispatchReceiver = irGet(maskParameter(newIrFunction, valueParameter.index / 32)) + putValueArgument(0, irInt(1 shl (valueParameter.index % 32))) + }, irInt(0)) + + val expressionBody = valueParameter.defaultValue!! + + expressionBody.transformChildrenVoid(object : IrElementTransformerVoid() { + override fun visitGetValue(expression: IrGetValue): IrExpression { + log { "GetValue: ${expression.symbol.owner}" } + val valueSymbol = variables[expression.symbol.owner] ?: return expression + return irGet(valueSymbol) + } + }) + + irIfThenElse( + type = parameter.type, + condition = condition, + thenPart = expressionBody.expression, + elsePart = irGet(parameter) + ) + } else { + irGet(parameter) + } + + val temporaryVariable = irTemporary(argument, nameHint = parameter.name.asString()) + + params.add(temporaryVariable) + variables[valueParameter] = temporaryVariable + } + + if (irFunction is IrConstructor) { + +IrDelegatingConstructorCallImpl( + startOffset = irFunction.startOffset, + endOffset = irFunction.endOffset, + type = context.irBuiltIns.unitType, + symbol = irFunction.symbol, descriptor = irFunction.symbol.descriptor, + typeArgumentsCount = irFunction.typeParameters.size + ).apply { + dispatchReceiver = newIrFunction.dispatchReceiverParameter?.let { irGet(it) } + + params.forEachIndexed { i, variable -> putValueArgument(i, irGet(variable)) } + } + } else { + +irReturn(irCall(irFunction).apply { + dispatchReceiver = newIrFunction.dispatchReceiverParameter?.let { irGet(it) } + extensionReceiver = newIrFunction.extensionReceiverParameter?.let { irGet(it) } + + params.forEachIndexed { i, variable -> putValueArgument(i, irGet(variable)) } + }) + } + } + // Remove default argument initializers. + irFunction.valueParameters.forEach { + it.defaultValue = IrExpressionBodyImpl(IrErrorExpressionImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, it.type, "Default Stub")) + } + return listOf(irFunction, newIrFunction) } @@ -164,6 +163,23 @@ private fun maskParameter(function: IrFunction, number: Int) = private fun markerParameterDeclaration(function: IrFunction) = function.valueParameters.single { it.name == kConstructorMarkerName } +// Populates `overriddenSymbols` for the newly created functions +class DefaultParameterFakeOverrideCleanup(val context: CommonBackendContext): DeclarationContainerLoweringPass { + override fun lower(irDeclarationContainer: IrDeclarationContainer) { + for (func in irDeclarationContainer.declarations) { + if (func !is IrSimpleFunction) continue + + val defFunc = context.ir.defaultParameterDeclarationsCache[func] as? IrSimpleFunction ?: continue + + for (o in func.overriddenSymbols) { + (context.ir.defaultParameterDeclarationsCache[o.owner] as? IrSimpleFunction)?.let { + defFunc.overriddenSymbols.add(it.symbol) + } + } + } + } +} + open class DefaultParameterInjector constructor( val context: CommonBackendContext, private val skipInline: Boolean = true @@ -264,9 +280,7 @@ open class DefaultParameterInjector constructor( val declaration = expression.symbol.owner val keyFunction = declaration.findSuperMethodWithDefaultArguments()!! - val realFunction = keyFunction.generateDefaultsFunction(context) - - realFunction.parent = keyFunction.parent + val realFunction = keyFunction.generateDefaultsFunction(context, DECLARATION_ORIGIN_FUNCTION_FOR_DEFAULT_PARAMETER) log { "$declaration -> $realFunction" } val maskValues = Array((declaration.valueParameters.size + 31) / 32) { 0 } @@ -343,6 +357,7 @@ class DefaultParameterCleaner constructor(val context: CommonBackendContext) : F } } +// TODO this implementation is exponential private fun IrFunction.needsDefaultArgumentsLowering(skipInlineMethods: Boolean): Boolean { if (isInline && skipInlineMethods) return false if (valueParameters.any { it.defaultValue != null }) return true @@ -352,8 +367,8 @@ private fun IrFunction.needsDefaultArgumentsLowering(skipInlineMethods: Boolean) return overriddenSymbols.any { it.owner.needsDefaultArgumentsLowering(skipInlineMethods) } } -private fun IrFunction.generateDefaultsFunctionImpl(context: CommonBackendContext): IrFunction { - val newFunction = buildFunctionDeclaration(this) +private fun IrFunction.generateDefaultsFunctionImpl(context: CommonBackendContext, origin: IrDeclarationOrigin): IrFunction { + val newFunction = buildFunctionDeclaration(this, origin) val syntheticParameters = MutableList((valueParameters.size + 31) / 32) { i -> valueParameter(valueParameters.size + i, parameterMaskName(i), context.irBuiltIns.intType) @@ -375,6 +390,9 @@ private fun IrFunction.generateDefaultsFunctionImpl(context: CommonBackendContex newFunction.copyTypeParametersFrom(this) val newValueParameters = valueParameters.map { it.copyTo(newFunction) } + syntheticParameters + newValueParameters.forEach { + it.defaultValue = null + } newFunction.returnType = returnType newFunction.dispatchReceiverParameter = dispatchReceiverParameter?.run { @@ -385,17 +403,19 @@ private fun IrFunction.generateDefaultsFunctionImpl(context: CommonBackendContex annotations.mapTo(newFunction.annotations) { it.deepCopyWithSymbols() } + newFunction.parent = parent + return newFunction } -private fun buildFunctionDeclaration(irFunction: IrFunction): IrFunction { +private fun buildFunctionDeclaration(irFunction: IrFunction, origin: IrDeclarationOrigin): IrFunction { when (irFunction) { is IrConstructor -> { val descriptor = WrappedClassConstructorDescriptor(irFunction.descriptor.annotations, irFunction.descriptor.source) return IrConstructorImpl( irFunction.startOffset, irFunction.endOffset, - DECLARATION_ORIGIN_FUNCTION_FOR_DEFAULT_PARAMETER, + origin, IrConstructorSymbolImpl(descriptor), irFunction.name, irFunction.visibility, @@ -414,7 +434,7 @@ private fun buildFunctionDeclaration(irFunction: IrFunction): IrFunction { return IrFunctionImpl( irFunction.startOffset, irFunction.endOffset, - DECLARATION_ORIGIN_FUNCTION_FOR_DEFAULT_PARAMETER, + origin, IrSimpleFunctionSymbolImpl(descriptor), name, irFunction.visibility, @@ -432,9 +452,9 @@ private fun buildFunctionDeclaration(irFunction: IrFunction): IrFunction { } } -private fun IrFunction.generateDefaultsFunction(context: CommonBackendContext): IrFunction = +private fun IrFunction.generateDefaultsFunction(context: CommonBackendContext, origin: IrDeclarationOrigin): IrFunction = context.ir.defaultParameterDeclarationsCache.getOrPut(this) { - generateDefaultsFunctionImpl(context) + generateDefaultsFunctionImpl(context, origin) } object DECLARATION_ORIGIN_FUNCTION_FOR_DEFAULT_PARAMETER : diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/compiler.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/compiler.kt index bce360c6380..0d26b78d881 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/compiler.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/compiler.kt @@ -107,6 +107,7 @@ private fun JsIrBackendContext.lower(moduleFragment: IrModuleFragment, dependenc VarargLowering(this).lower(moduleFragment) LateinitLowering(this, true).lower(moduleFragment) DefaultArgumentStubGenerator(this).runOnFilesPostfix(moduleFragment) + DefaultParameterFakeOverrideCleanup(this).runOnFilesPostfix(moduleFragment) DefaultParameterInjector(this).runOnFilesPostfix(moduleFragment) DefaultParameterCleaner(this).runOnFilesPostfix(moduleFragment) SharedVariablesLowering(this).runOnFilesPostfix(moduleFragment) diff --git a/compiler/testData/codegen/box/defaultArguments/constructor/enum.kt b/compiler/testData/codegen/box/defaultArguments/constructor/enum.kt index fe698da0166..edc9e061d4c 100644 --- a/compiler/testData/codegen/box/defaultArguments/constructor/enum.kt +++ b/compiler/testData/codegen/box/defaultArguments/constructor/enum.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR enum class A(val a: Int = 1) { FIRST(), SECOND(2) diff --git a/compiler/testData/codegen/box/defaultArguments/constructor/enumWithOneDefArg.kt b/compiler/testData/codegen/box/defaultArguments/constructor/enumWithOneDefArg.kt index de01ed54517..339ab868c0d 100644 --- a/compiler/testData/codegen/box/defaultArguments/constructor/enumWithOneDefArg.kt +++ b/compiler/testData/codegen/box/defaultArguments/constructor/enumWithOneDefArg.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR enum class Foo(val a: Int = 1, val b: String) { B(2, "b"), C(b = "b") diff --git a/compiler/testData/codegen/box/defaultArguments/constructor/enumWithTwoDefArgs.kt b/compiler/testData/codegen/box/defaultArguments/constructor/enumWithTwoDefArgs.kt index c8564a7c4eb..7a7d6db0814 100644 --- a/compiler/testData/codegen/box/defaultArguments/constructor/enumWithTwoDefArgs.kt +++ b/compiler/testData/codegen/box/defaultArguments/constructor/enumWithTwoDefArgs.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR enum class Foo(val a: Int = 1, val b: String = "a") { A(), B(2, "b"), diff --git a/compiler/testData/codegen/box/defaultArguments/constructor/enumWithTwoDoubleDefArgs.kt b/compiler/testData/codegen/box/defaultArguments/constructor/enumWithTwoDoubleDefArgs.kt index e2efed53653..e461fd6a32e 100644 --- a/compiler/testData/codegen/box/defaultArguments/constructor/enumWithTwoDoubleDefArgs.kt +++ b/compiler/testData/codegen/box/defaultArguments/constructor/enumWithTwoDoubleDefArgs.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR enum class Foo(val a: Double = 1.0, val b: Double = 1.0) { A(), B(2.0, 2.0), diff --git a/compiler/testData/codegen/box/defaultArguments/function/complexInheritance.kt b/compiler/testData/codegen/box/defaultArguments/function/complexInheritance.kt index d28143e5321..5a8df66d795 100644 --- a/compiler/testData/codegen/box/defaultArguments/function/complexInheritance.kt +++ b/compiler/testData/codegen/box/defaultArguments/function/complexInheritance.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // See KT-21968 interface A { diff --git a/compiler/testData/codegen/box/defaultArguments/function/funInTrait.kt b/compiler/testData/codegen/box/defaultArguments/function/funInTrait.kt index efb47be53ae..06b181e10b6 100644 --- a/compiler/testData/codegen/box/defaultArguments/function/funInTrait.kt +++ b/compiler/testData/codegen/box/defaultArguments/function/funInTrait.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR interface Foo { fun foo(a: Double = 1.0): Double } diff --git a/compiler/testData/codegen/box/defaultArguments/function/funInTraitChain.kt b/compiler/testData/codegen/box/defaultArguments/function/funInTraitChain.kt index 46f96213a5d..d678f2099e0 100644 --- a/compiler/testData/codegen/box/defaultArguments/function/funInTraitChain.kt +++ b/compiler/testData/codegen/box/defaultArguments/function/funInTraitChain.kt @@ -1,5 +1,4 @@ // IGNORE_BACKEND: JVM_IR -// IGNORE_BACKEND: JS_IR // IGNORE_BACKEND: JVM // See KT-15971 diff --git a/compiler/testData/codegen/box/defaultArguments/function/kt5232.kt b/compiler/testData/codegen/box/defaultArguments/function/kt5232.kt index 0c424a01af9..8b91d2bd2d5 100644 --- a/compiler/testData/codegen/box/defaultArguments/function/kt5232.kt +++ b/compiler/testData/codegen/box/defaultArguments/function/kt5232.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR interface A { fun visit(a:String, b:String="") : String = b + a } diff --git a/compiler/testData/codegen/box/defaultArguments/function/trait.kt b/compiler/testData/codegen/box/defaultArguments/function/trait.kt index 2e23cb26e6c..91bafe072f3 100644 --- a/compiler/testData/codegen/box/defaultArguments/function/trait.kt +++ b/compiler/testData/codegen/box/defaultArguments/function/trait.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR interface Base { fun bar(a: String = "abc"): String = a + " from interface" } diff --git a/compiler/testData/codegen/box/defaultArguments/inheritedFromInterfaceViaAbstractSuperclass.kt b/compiler/testData/codegen/box/defaultArguments/inheritedFromInterfaceViaAbstractSuperclass.kt index c4744eaf3d3..b74007df30e 100644 --- a/compiler/testData/codegen/box/defaultArguments/inheritedFromInterfaceViaAbstractSuperclass.kt +++ b/compiler/testData/codegen/box/defaultArguments/inheritedFromInterfaceViaAbstractSuperclass.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR interface I { fun foo(x: Int = 23): String } diff --git a/compiler/testData/codegen/box/defaultArguments/signature/kt2789.kt b/compiler/testData/codegen/box/defaultArguments/signature/kt2789.kt index 6f9cefe428b..043b0d071a3 100644 --- a/compiler/testData/codegen/box/defaultArguments/signature/kt2789.kt +++ b/compiler/testData/codegen/box/defaultArguments/signature/kt2789.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR interface FooTrait { fun make(size: Int = 16) : T diff --git a/compiler/testData/codegen/box/delegation/withDefaultParameters.kt b/compiler/testData/codegen/box/delegation/withDefaultParameters.kt index 89654eb631b..b771a4bdc9a 100644 --- a/compiler/testData/codegen/box/delegation/withDefaultParameters.kt +++ b/compiler/testData/codegen/box/delegation/withDefaultParameters.kt @@ -1,5 +1,4 @@ // IGNORE_BACKEND: JVM_IR -// IGNORE_BACKEND: JS_IR // IGNORE_BACKEND: JVM var log = "" diff --git a/compiler/testData/codegen/box/enum/defaultCtor/constructorWithDefaultArguments.kt b/compiler/testData/codegen/box/enum/defaultCtor/constructorWithDefaultArguments.kt index a146f5b1a4e..fcdaf5b62ae 100644 --- a/compiler/testData/codegen/box/enum/defaultCtor/constructorWithDefaultArguments.kt +++ b/compiler/testData/codegen/box/enum/defaultCtor/constructorWithDefaultArguments.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR enum class Test(val str: String = "OK") { OK } diff --git a/compiler/testData/codegen/box/enum/defaultCtor/entryClassConstructorWithDefaultArguments.kt b/compiler/testData/codegen/box/enum/defaultCtor/entryClassConstructorWithDefaultArguments.kt index 2cdbb91e520..dfe8da0b5ca 100644 --- a/compiler/testData/codegen/box/enum/defaultCtor/entryClassConstructorWithDefaultArguments.kt +++ b/compiler/testData/codegen/box/enum/defaultCtor/entryClassConstructorWithDefaultArguments.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR enum class Test(val str: String = "OK") { OK { fun foo() {} diff --git a/compiler/testData/codegen/box/enum/manyDefaultParameters.kt b/compiler/testData/codegen/box/enum/manyDefaultParameters.kt index 769b56d355d..96d859b71c6 100644 --- a/compiler/testData/codegen/box/enum/manyDefaultParameters.kt +++ b/compiler/testData/codegen/box/enum/manyDefaultParameters.kt @@ -1,5 +1,4 @@ // IGNORE_BACKEND: JVM_IR -// IGNORE_BACKEND: JS_IR enum class ClassTemplate( // var bug: Int = 1, var code: Int, diff --git a/compiler/testData/codegen/box/functions/defaultargs4.kt b/compiler/testData/codegen/box/functions/defaultargs4.kt index 21afbb3cc0e..b98b9a95d64 100644 --- a/compiler/testData/codegen/box/functions/defaultargs4.kt +++ b/compiler/testData/codegen/box/functions/defaultargs4.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR interface A { fun bar2(arg: Int = 239) : Int diff --git a/compiler/testData/codegen/box/functions/defaultargs6.kt b/compiler/testData/codegen/box/functions/defaultargs6.kt index ac8c2370eca..90c4e943d5d 100644 --- a/compiler/testData/codegen/box/functions/defaultargs6.kt +++ b/compiler/testData/codegen/box/functions/defaultargs6.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR interface A { fun foo(x: Int, y: Int = x + 20, z: Int = y * 2) = z } diff --git a/compiler/testData/codegen/box/inlineClasses/defaultParameterValues/defaultInterfaceFunParameterValuesOfInlineClassType.kt b/compiler/testData/codegen/box/inlineClasses/defaultParameterValues/defaultInterfaceFunParameterValuesOfInlineClassType.kt index 2350860269d..fcf46728a9b 100644 --- a/compiler/testData/codegen/box/inlineClasses/defaultParameterValues/defaultInterfaceFunParameterValuesOfInlineClassType.kt +++ b/compiler/testData/codegen/box/inlineClasses/defaultParameterValues/defaultInterfaceFunParameterValuesOfInlineClassType.kt @@ -1,5 +1,5 @@ // !LANGUAGE: +InlineClasses -// IGNORE_BACKEND: JVM_IR, JS_IR +// IGNORE_BACKEND: JVM_IR inline class Z(val z: Int) diff --git a/compiler/testData/codegen/box/inlineClasses/kt27132.kt b/compiler/testData/codegen/box/inlineClasses/kt27132.kt index a6e4ef1658e..d41f580cae0 100644 --- a/compiler/testData/codegen/box/inlineClasses/kt27132.kt +++ b/compiler/testData/codegen/box/inlineClasses/kt27132.kt @@ -1,5 +1,5 @@ // !LANGUAGE: +InlineClasses -// IGNORE_BACKEND: JVM_IR, JS_IR +// IGNORE_BACKEND: JVM_IR // WITH_RUNTIME inline class Ucn(private val i: UInt) diff --git a/compiler/testData/codegen/box/multiplatform/defaultArguments/bothInExpectAndActual2.kt b/compiler/testData/codegen/box/multiplatform/defaultArguments/bothInExpectAndActual2.kt index 19ab6658ad5..431ad307f58 100644 --- a/compiler/testData/codegen/box/multiplatform/defaultArguments/bothInExpectAndActual2.kt +++ b/compiler/testData/codegen/box/multiplatform/defaultArguments/bothInExpectAndActual2.kt @@ -1,5 +1,5 @@ // !LANGUAGE: +MultiPlatformProjects -// IGNORE_BACKEND: JVM_IR, JS_IR, NATIVE +// IGNORE_BACKEND: JVM_IR, NATIVE // FILE: common.kt expect interface I { diff --git a/compiler/testData/codegen/box/multiplatform/defaultArguments/delegatedExpectedInterface.kt b/compiler/testData/codegen/box/multiplatform/defaultArguments/delegatedExpectedInterface.kt index 560cffee5a7..1dfb1ef0fe6 100644 --- a/compiler/testData/codegen/box/multiplatform/defaultArguments/delegatedExpectedInterface.kt +++ b/compiler/testData/codegen/box/multiplatform/defaultArguments/delegatedExpectedInterface.kt @@ -1,6 +1,5 @@ // !LANGUAGE: +MultiPlatformProjects // IGNORE_BACKEND: JVM_IR -// IGNORE_BACKEND: JS_IR // IGNORE_BACKEND: JVM // FILE: lib.kt diff --git a/compiler/testData/codegen/box/multiplatform/defaultArguments/inheritedFromExpectedInterface.kt b/compiler/testData/codegen/box/multiplatform/defaultArguments/inheritedFromExpectedInterface.kt index dcbd67de793..7793809e421 100644 --- a/compiler/testData/codegen/box/multiplatform/defaultArguments/inheritedFromExpectedInterface.kt +++ b/compiler/testData/codegen/box/multiplatform/defaultArguments/inheritedFromExpectedInterface.kt @@ -1,6 +1,5 @@ // !LANGUAGE: +MultiPlatformProjects // IGNORE_BACKEND: JVM_IR -// IGNORE_BACKEND: JS_IR // FILE: lib.kt expect interface I { diff --git a/compiler/testData/codegen/box/multiplatform/defaultArguments/inheritedViaAnotherInterfaceIndirectly.kt b/compiler/testData/codegen/box/multiplatform/defaultArguments/inheritedViaAnotherInterfaceIndirectly.kt index 8f74fe01acc..c4b8332d606 100644 --- a/compiler/testData/codegen/box/multiplatform/defaultArguments/inheritedViaAnotherInterfaceIndirectly.kt +++ b/compiler/testData/codegen/box/multiplatform/defaultArguments/inheritedViaAnotherInterfaceIndirectly.kt @@ -1,6 +1,5 @@ // !LANGUAGE: +MultiPlatformProjects // IGNORE_BACKEND: JVM_IR -// IGNORE_BACKEND: JS_IR // FILE: lib.kt diff --git a/compiler/testData/codegen/box/traits/interfaceWithNonAbstractFunIndirect.kt b/compiler/testData/codegen/box/traits/interfaceWithNonAbstractFunIndirect.kt index eab6337b7e7..e77b2472214 100644 --- a/compiler/testData/codegen/box/traits/interfaceWithNonAbstractFunIndirect.kt +++ b/compiler/testData/codegen/box/traits/interfaceWithNonAbstractFunIndirect.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR interface I { fun foo(): String = "foo" diff --git a/compiler/testData/codegen/box/traits/interfaceWithNonAbstractFunIndirectGeneric.kt b/compiler/testData/codegen/box/traits/interfaceWithNonAbstractFunIndirectGeneric.kt index 8e65c276b34..65f641c2d5a 100644 --- a/compiler/testData/codegen/box/traits/interfaceWithNonAbstractFunIndirectGeneric.kt +++ b/compiler/testData/codegen/box/traits/interfaceWithNonAbstractFunIndirectGeneric.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR interface I { fun foo(x: T): String = "foo($x)" diff --git a/js/js.translator/testData/box/defaultArguments/enumSuperConstructor.kt b/js/js.translator/testData/box/defaultArguments/enumSuperConstructor.kt index 12df691cef4..47bcfe214b2 100644 --- a/js/js.translator/testData/box/defaultArguments/enumSuperConstructor.kt +++ b/js/js.translator/testData/box/defaultArguments/enumSuperConstructor.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // EXPECTED_REACHABLE_NODES: 1294 package foo diff --git a/js/js.translator/testData/box/defaultArguments/enumWithDefArg.kt b/js/js.translator/testData/box/defaultArguments/enumWithDefArg.kt index 4284c5d8460..2714b2bdcc4 100644 --- a/js/js.translator/testData/box/defaultArguments/enumWithDefArg.kt +++ b/js/js.translator/testData/box/defaultArguments/enumWithDefArg.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // EXPECTED_REACHABLE_NODES: 1291 package foo @@ -7,9 +6,14 @@ enum class A(val a: Int = 1) { SECOND(2) } +class B(val a: Int = 1) + fun box(): String { if (A.FIRST.a == 1 && A.SECOND.a == 2) { return "OK" } + + B() + return "fail" } diff --git a/js/js.translator/testData/box/defaultArguments/enumWithOneDefArg.kt b/js/js.translator/testData/box/defaultArguments/enumWithOneDefArg.kt index f98a4d47668..9d4bcc6e2a8 100644 --- a/js/js.translator/testData/box/defaultArguments/enumWithOneDefArg.kt +++ b/js/js.translator/testData/box/defaultArguments/enumWithOneDefArg.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // EXPECTED_REACHABLE_NODES: 1291 package foo diff --git a/js/js.translator/testData/box/defaultArguments/enumWithTwoDefArgs.kt b/js/js.translator/testData/box/defaultArguments/enumWithTwoDefArgs.kt index c6753ee6052..7c33a7fcd40 100644 --- a/js/js.translator/testData/box/defaultArguments/enumWithTwoDefArgs.kt +++ b/js/js.translator/testData/box/defaultArguments/enumWithTwoDefArgs.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // EXPECTED_REACHABLE_NODES: 1295 package foo diff --git a/js/js.translator/testData/box/defaultArguments/inheritViaAnotherInterface.kt b/js/js.translator/testData/box/defaultArguments/inheritViaAnotherInterface.kt index a683aedd973..4f6fe1f4c61 100644 --- a/js/js.translator/testData/box/defaultArguments/inheritViaAnotherInterface.kt +++ b/js/js.translator/testData/box/defaultArguments/inheritViaAnotherInterface.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // EXPECTED_REACHABLE_NODES: 1270 // FILE: classes.kt class C : J diff --git a/js/js.translator/testData/box/defaultArguments/inheritViaAnotherInterfaceIndirectly.kt b/js/js.translator/testData/box/defaultArguments/inheritViaAnotherInterfaceIndirectly.kt index 944f2cb4d53..926b106fc80 100644 --- a/js/js.translator/testData/box/defaultArguments/inheritViaAnotherInterfaceIndirectly.kt +++ b/js/js.translator/testData/box/defaultArguments/inheritViaAnotherInterfaceIndirectly.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // EXPECTED_REACHABLE_NODES: 1304 interface I { fun foo(x: String = "default"): String = "I.foo($x)" diff --git a/js/js.translator/testData/box/defaultArguments/virtualCallWithDefArg.kt b/js/js.translator/testData/box/defaultArguments/virtualCallWithDefArg.kt index 282927da075..676c48dc654 100644 --- a/js/js.translator/testData/box/defaultArguments/virtualCallWithDefArg.kt +++ b/js/js.translator/testData/box/defaultArguments/virtualCallWithDefArg.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // EXPECTED_REACHABLE_NODES: 1299 package foo diff --git a/js/js.translator/testData/box/inlineMultiModule/inlineableAliasForExternalDeclaration.kt b/js/js.translator/testData/box/inlineMultiModule/inlineableAliasForExternalDeclaration.kt index 42376a15ae8..7cdf142acd7 100644 --- a/js/js.translator/testData/box/inlineMultiModule/inlineableAliasForExternalDeclaration.kt +++ b/js/js.translator/testData/box/inlineMultiModule/inlineableAliasForExternalDeclaration.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // EXPECTED_REACHABLE_NODES: 1282 // MODULE: lib // FILE: lib.kt diff --git a/js/js.translator/testData/box/inlineMultiModule/repeatedImport.kt b/js/js.translator/testData/box/inlineMultiModule/repeatedImport.kt index 46c4c384467..8f8bc77c521 100644 --- a/js/js.translator/testData/box/inlineMultiModule/repeatedImport.kt +++ b/js/js.translator/testData/box/inlineMultiModule/repeatedImport.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // EXPECTED_REACHABLE_NODES: 1284 // MODULE: lib // FILE: lib.kt diff --git a/js/js.translator/testData/box/jsCode/forWithoutInit.kt b/js/js.translator/testData/box/jsCode/forWithoutInit.kt index aa3b02bf17b..ba016379db7 100644 --- a/js/js.translator/testData/box/jsCode/forWithoutInit.kt +++ b/js/js.translator/testData/box/jsCode/forWithoutInit.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JS_IR // EXPECTED_REACHABLE_NODES: 1281 // FILE: a.kt fun foo(n: Int): String = js("""