From d0c7346c75e445a1d3f92132887f41ec4a14ea19 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Tue, 17 Sep 2024 00:40:26 +0200 Subject: [PATCH] [Wasm] Fix equality checks for non-capturing property references #KT-71474 Fixed --- ...LFirBlackBoxCodegenBasedTestGenerated.java | 18 ++ ...rsedBlackBoxCodegenBasedTestGenerated.java | 18 ++ ...LightTreeBlackBoxCodegenTestGenerated.java | 18 ++ .../FirPsiBlackBoxCodegenTestGenerated.java | 18 ++ .../kotlin/backend/wasm/WasmSymbols.kt | 18 +- .../lower/WasmPropertyReferenceLowering.kt | 31 +-- .../callableReference/equality/kproperty.kt | 63 ++++++ .../kpropertyWithCapturingEquality.kt | 40 ++++ .../kpropertyWithCapturingInequality.kt | 31 +++ .../equality/simpleEquality.kt | 9 - .../JvmAbiConsistencyTestBoxGenerated.java | 18 ++ .../IrBlackBoxCodegenTestGenerated.java | 18 ++ ...kBoxCodegenWithIrInlinerTestGenerated.java | 18 ++ ...xCodegenTestWithInlineScopesGenerated.java | 18 ++ .../LightAnalysisModeTestGenerated.java | 15 ++ .../fir/FirJsCodegenBoxTestGenerated.java | 18 ++ .../fir/FirJsES6CodegenBoxTestGenerated.java | 18 ++ .../test/ir/IrJsCodegenBoxTestGenerated.java | 18 ++ .../ir/IrJsES6CodegenBoxTestGenerated.java | 18 ++ .../kotlin/wasm/internal/KPropertyImpl2.kt | 214 ++++++++++++++++++ .../FirNativeCodegenBoxTestGenerated.java | 18 ++ .../FirNativeCodegenBoxTestNoPLGenerated.java | 18 ++ .../NativeCodegenBoxTestGenerated.java | 18 ++ .../NativeCodegenBoxTestNoPLGenerated.java | 18 ++ .../FirWasmJsCodegenBoxTestGenerated.java | 18 ++ .../test/K1WasmCodegenBoxTestGenerated.java | 18 ++ 26 files changed, 704 insertions(+), 41 deletions(-) create mode 100644 compiler/testData/codegen/box/callableReference/equality/kproperty.kt create mode 100644 compiler/testData/codegen/box/callableReference/equality/kpropertyWithCapturingEquality.kt create mode 100644 compiler/testData/codegen/box/callableReference/equality/kpropertyWithCapturingInequality.kt create mode 100644 libraries/stdlib/wasm/internal/kotlin/wasm/internal/KPropertyImpl2.kt diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirBlackBoxCodegenBasedTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirBlackBoxCodegenBasedTestGenerated.java index 3f1dcb17386d2..59be3debcd2e0 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirBlackBoxCodegenBasedTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirBlackBoxCodegenBasedTestGenerated.java @@ -4979,6 +4979,24 @@ public void testExtensionReceiverVsDefault() { runTest("compiler/testData/codegen/box/callableReference/equality/extensionReceiverVsDefault.kt"); } + @Test + @TestMetadata("kproperty.kt") + public void testKproperty() { + runTest("compiler/testData/codegen/box/callableReference/equality/kproperty.kt"); + } + + @Test + @TestMetadata("kpropertyWithCapturingEquality.kt") + public void testKpropertyWithCapturingEquality() { + runTest("compiler/testData/codegen/box/callableReference/equality/kpropertyWithCapturingEquality.kt"); + } + + @Test + @TestMetadata("kpropertyWithCapturingInequality.kt") + public void testKpropertyWithCapturingInequality() { + runTest("compiler/testData/codegen/box/callableReference/equality/kpropertyWithCapturingInequality.kt"); + } + @Test @TestMetadata("noCoercionToUnitIfFunctionAlreadyReturnsUnit.kt") public void testNoCoercionToUnitIfFunctionAlreadyReturnsUnit() { diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirReversedBlackBoxCodegenBasedTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirReversedBlackBoxCodegenBasedTestGenerated.java index fda44a676a928..9c6a6b2f18be1 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirReversedBlackBoxCodegenBasedTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirReversedBlackBoxCodegenBasedTestGenerated.java @@ -4979,6 +4979,24 @@ public void testExtensionReceiverVsDefault() { runTest("compiler/testData/codegen/box/callableReference/equality/extensionReceiverVsDefault.kt"); } + @Test + @TestMetadata("kproperty.kt") + public void testKproperty() { + runTest("compiler/testData/codegen/box/callableReference/equality/kproperty.kt"); + } + + @Test + @TestMetadata("kpropertyWithCapturingEquality.kt") + public void testKpropertyWithCapturingEquality() { + runTest("compiler/testData/codegen/box/callableReference/equality/kpropertyWithCapturingEquality.kt"); + } + + @Test + @TestMetadata("kpropertyWithCapturingInequality.kt") + public void testKpropertyWithCapturingInequality() { + runTest("compiler/testData/codegen/box/callableReference/equality/kpropertyWithCapturingInequality.kt"); + } + @Test @TestMetadata("noCoercionToUnitIfFunctionAlreadyReturnsUnit.kt") public void testNoCoercionToUnitIfFunctionAlreadyReturnsUnit() { diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java index c331a4441e0fc..3c27735a267b3 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxCodegenTestGenerated.java @@ -4950,6 +4950,24 @@ public void testExtensionReceiverVsDefault() { runTest("compiler/testData/codegen/box/callableReference/equality/extensionReceiverVsDefault.kt"); } + @Test + @TestMetadata("kproperty.kt") + public void testKproperty() { + runTest("compiler/testData/codegen/box/callableReference/equality/kproperty.kt"); + } + + @Test + @TestMetadata("kpropertyWithCapturingEquality.kt") + public void testKpropertyWithCapturingEquality() { + runTest("compiler/testData/codegen/box/callableReference/equality/kpropertyWithCapturingEquality.kt"); + } + + @Test + @TestMetadata("kpropertyWithCapturingInequality.kt") + public void testKpropertyWithCapturingInequality() { + runTest("compiler/testData/codegen/box/callableReference/equality/kpropertyWithCapturingInequality.kt"); + } + @Test @TestMetadata("noCoercionToUnitIfFunctionAlreadyReturnsUnit.kt") public void testNoCoercionToUnitIfFunctionAlreadyReturnsUnit() { diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java index f4b73a2358f86..4e81258899967 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxCodegenTestGenerated.java @@ -4950,6 +4950,24 @@ public void testExtensionReceiverVsDefault() { runTest("compiler/testData/codegen/box/callableReference/equality/extensionReceiverVsDefault.kt"); } + @Test + @TestMetadata("kproperty.kt") + public void testKproperty() { + runTest("compiler/testData/codegen/box/callableReference/equality/kproperty.kt"); + } + + @Test + @TestMetadata("kpropertyWithCapturingEquality.kt") + public void testKpropertyWithCapturingEquality() { + runTest("compiler/testData/codegen/box/callableReference/equality/kpropertyWithCapturingEquality.kt"); + } + + @Test + @TestMetadata("kpropertyWithCapturingInequality.kt") + public void testKpropertyWithCapturingInequality() { + runTest("compiler/testData/codegen/box/callableReference/equality/kpropertyWithCapturingInequality.kt"); + } + @Test @TestMetadata("noCoercionToUnitIfFunctionAlreadyReturnsUnit.kt") public void testNoCoercionToUnitIfFunctionAlreadyReturnsUnit() { diff --git a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/WasmSymbols.kt b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/WasmSymbols.kt index 01f4d7b10f879..54e1b50d42cba 100644 --- a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/WasmSymbols.kt +++ b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/WasmSymbols.kt @@ -254,20 +254,18 @@ class WasmSymbols( (0..2).map { getInternalFunction("startCoroutineUninterceptedOrReturnIntrinsic$it") } // KProperty implementations - val kLocalDelegatedPropertyImpl: IrClassSymbol = this.getInternalClass("KLocalDelegatedPropertyImpl") - val kLocalDelegatedMutablePropertyImpl: IrClassSymbol = this.getInternalClass("KLocalDelegatedMutablePropertyImpl") - val kProperty0Impl: IrClassSymbol = this.getInternalClass("KProperty0Impl") - val kProperty1Impl: IrClassSymbol = this.getInternalClass("KProperty1Impl") - val kProperty2Impl: IrClassSymbol = this.getInternalClass("KProperty2Impl") - val kMutableProperty0Impl: IrClassSymbol = this.getInternalClass("KMutableProperty0Impl") - val kMutableProperty1Impl: IrClassSymbol = this.getInternalClass("KMutableProperty1Impl") - val kMutableProperty2Impl: IrClassSymbol = this.getInternalClass("KMutableProperty2Impl") + val kLocalDelegatedPropertyImpl: IrClassSymbol = this.getInternalClass("KLocalDelegatedPropertyImpl2") + val kLocalDelegatedMutablePropertyImpl: IrClassSymbol = this.getInternalClass("KLocalDelegatedMutablePropertyImpl2") + val kProperty0Impl: IrClassSymbol = this.getInternalClass("KProperty0Impl2") + val kProperty1Impl: IrClassSymbol = this.getInternalClass("KProperty1Impl2") + val kProperty2Impl: IrClassSymbol = this.getInternalClass("KProperty2Impl2") + val kMutableProperty0Impl: IrClassSymbol = this.getInternalClass("KMutableProperty0Impl2") + val kMutableProperty1Impl: IrClassSymbol = this.getInternalClass("KMutableProperty1Impl2") + val kMutableProperty2Impl: IrClassSymbol = this.getInternalClass("KMutableProperty2Impl2") val kMutableProperty0: IrClassSymbol = getIrClass(FqName("kotlin.reflect.KMutableProperty0")) val kMutableProperty1: IrClassSymbol = getIrClass(FqName("kotlin.reflect.KMutableProperty1")) val kMutableProperty2: IrClassSymbol = getIrClass(FqName("kotlin.reflect.KMutableProperty2")) - val kTypeStub = getInternalFunction("kTypeStub") - val arraysCopyInto = findFunctions(collectionsPackage.memberScope, Name.identifier("copyInto")) .map { symbolTable.descriptorExtension.referenceSimpleFunction(it) } diff --git a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/lower/WasmPropertyReferenceLowering.kt b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/lower/WasmPropertyReferenceLowering.kt index b12fb89c63bd0..a151ef05b53b8 100644 --- a/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/lower/WasmPropertyReferenceLowering.kt +++ b/compiler/ir/backend.wasm/src/org/jetbrains/kotlin/backend/wasm/lower/WasmPropertyReferenceLowering.kt @@ -26,10 +26,7 @@ import org.jetbrains.kotlin.ir.types.IrSimpleType import org.jetbrains.kotlin.ir.types.IrType import org.jetbrains.kotlin.ir.types.classifierOrFail import org.jetbrains.kotlin.ir.types.typeWith -import org.jetbrains.kotlin.ir.util.SYNTHETIC_OFFSET -import org.jetbrains.kotlin.ir.util.constructors -import org.jetbrains.kotlin.ir.util.functions -import org.jetbrains.kotlin.ir.util.getKFunctionType +import org.jetbrains.kotlin.ir.util.* import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid import org.jetbrains.kotlin.name.Name @@ -38,10 +35,6 @@ internal class WasmPropertyReferenceLowering(val context: WasmBackendContext) : private var tempIndex = 0 val symbols = context.wasmSymbols - fun createKTypeGenerator(): KTypeGeneratorInterface { - return KTypeGeneratorInterface { this.irCall(symbols.kTypeStub) } - } - private fun getKPropertyImplConstructor( receiverTypes: List, returnType: IrType, @@ -80,10 +73,6 @@ internal class WasmPropertyReferenceLowering(val context: WasmBackendContext) : return classSymbol.constructors.single() to arguments } - fun interface KTypeGeneratorInterface { - fun IrBuilderWithScope.irKType(type: IrType): IrExpression - } - override fun lower(irFile: IrFile) { // Somehow there is no reasonable common ancestor for IrProperty and IrLocalDelegatedProperty, // so index by IrDeclaration. @@ -119,7 +108,6 @@ internal class WasmPropertyReferenceLowering(val context: WasmBackendContext) : override fun visitPropertyReference(expression: IrPropertyReference): IrExpression { expression.transformChildrenVoid(this) - val kTypeGenerator = createKTypeGenerator() val startOffset = expression.startOffset val endOffset = expression.endOffset val irBuilder = context.createIrBuilder(currentScope!!.scope.scopeOwnerSymbol, startOffset, endOffset) @@ -128,7 +116,7 @@ internal class WasmPropertyReferenceLowering(val context: WasmBackendContext) : return when (receiversCount) { 0 -> { // Cache KProperties with no arguments. val field = kProperties.getOrPut(expression.symbol.owner) { - createKProperty(expression, kTypeGenerator, this) to kProperties.size + createKProperty(expression, this) to kProperties.size } irCall(arrayItemGetter).apply { @@ -137,7 +125,7 @@ internal class WasmPropertyReferenceLowering(val context: WasmBackendContext) : } } - 1 -> createKProperty(expression, kTypeGenerator, this) // Has receiver. + 1 -> createKProperty(expression, this) // Has receiver. else -> error("Callable reference to properties with two receivers is not allowed: ${expression.symbol.owner.name}") } @@ -160,7 +148,6 @@ internal class WasmPropertyReferenceLowering(val context: WasmBackendContext) : createLocalKProperty( expression.symbol.owner.name.asString(), expression.getter.owner.returnType, - createKTypeGenerator(), this ) to kProperties.size } @@ -187,7 +174,6 @@ internal class WasmPropertyReferenceLowering(val context: WasmBackendContext) : private fun createKProperty( expression: IrPropertyReference, - kTypeGenerator: KTypeGeneratorInterface, irBuilder: IrBuilderWithScope ): IrExpression { val startOffset = expression.startOffset @@ -260,14 +246,17 @@ internal class WasmPropertyReferenceLowering(val context: WasmBackendContext) : isMutable = setterCallableReference != null ) + val capturedReceiver = expression.dispatchReceiver != null || expression.dispatchReceiver != null + val initializerType = symbol.owner.returnType.classifierOrFail.typeWith(constructorTypeArguments) val initializer = irCall(symbol, initializerType, constructorTypeArguments).apply { putValueArgument(0, irString(expression.symbol.owner.name.asString())) - putValueArgument(1, with(kTypeGenerator) { irKType(returnType) }) + putValueArgument(1, irString(expression.symbol.owner.parent.kotlinFqName.asString())) + putValueArgument(2, irBoolean(capturedReceiver)) if (getterCallableReference != null) - putValueArgument(2, getterCallableReference) + putValueArgument(3, getterCallableReference) if (setterCallableReference != null) - putValueArgument(3, setterCallableReference) + putValueArgument(4, setterCallableReference) } +initializer } @@ -276,7 +265,6 @@ internal class WasmPropertyReferenceLowering(val context: WasmBackendContext) : private fun createLocalKProperty( propertyName: String, propertyType: IrType, - kTypeGenerator: KTypeGeneratorInterface, irBuilder: IrBuilderWithScope ): IrExpression { irBuilder.run { @@ -289,7 +277,6 @@ internal class WasmPropertyReferenceLowering(val context: WasmBackendContext) : val initializerType = symbol.owner.returnType.classifierOrFail.typeWith(constructorTypeArguments) val initializer = irCall(symbol, initializerType, constructorTypeArguments).apply { putValueArgument(0, irString(propertyName)) - putValueArgument(1, with(kTypeGenerator) { irKType(propertyType) }) } return initializer } diff --git a/compiler/testData/codegen/box/callableReference/equality/kproperty.kt b/compiler/testData/codegen/box/callableReference/equality/kproperty.kt new file mode 100644 index 0000000000000..c0a722c88a4d7 --- /dev/null +++ b/compiler/testData/codegen/box/callableReference/equality/kproperty.kt @@ -0,0 +1,63 @@ +// IGNORE_BACKEND: JS, JS_IR +// IGNORE_BACKEND: JS_IR_ES6 +// WITH_STDLIB +// FILE: test.kt + +import kotlin.test.assertEquals + +val topLevelVal = "" +var topLevelVar = "" + +val String.bar get() = "top" +val Foo.baz get() = "top" + +class Foo { + val memberVal = "" + var memberVar = "" + + val bar = "member" + private val baz = "member" + + companion object { + fun referenceToMemberBaz() = Foo::baz + } +} + +fun box(): String { + checkEqual(::topLevelVal, ::topLevelVal) + checkEqual(::topLevelVar, ::topLevelVar) + checkEqual(::topLevelVal, referenceTopLevelValFromOtherFile()) + checkEqual(::topLevelVar, referenceTopLevelVarFromOtherFile()) + + checkEqual(Foo::memberVal, Foo::memberVal) + checkEqual(Foo::memberVar, Foo::memberVar) + checkEqual(Foo::memberVal, referenceMemberValFromOtherFile()) + checkEqual(Foo::memberVar, referenceMemberVarFromOtherFile()) + + checkNotEqual(String::bar, Foo::bar) + assertEquals("top", String::bar.get("")) + assertEquals("member", Foo::bar.get(Foo())) + + checkNotEqual(Foo::baz, Foo.referenceToMemberBaz()) + assertEquals("top", Foo::baz.get(Foo())) + assertEquals("member", Foo.referenceToMemberBaz().get(Foo())) + + return "OK" +} + +fun checkEqual(x: Any, y: Any) { + if (x != y || y != x) throw AssertionError("$x and $y should be equal") + if (x.hashCode() != y.hashCode()) throw AssertionError("$x and $y should have the same hash code") +} + +fun checkNotEqual(x: Any, y: Any) { + if (x == y || y == x) throw AssertionError("$x and $y should NOT be equal") +} + +// FILE: otherFile.kt + +fun referenceTopLevelValFromOtherFile() = ::topLevelVal +fun referenceTopLevelVarFromOtherFile() = ::topLevelVar +fun referenceMemberValFromOtherFile() = Foo::memberVal +fun referenceMemberVarFromOtherFile() = Foo::memberVar + diff --git a/compiler/testData/codegen/box/callableReference/equality/kpropertyWithCapturingEquality.kt b/compiler/testData/codegen/box/callableReference/equality/kpropertyWithCapturingEquality.kt new file mode 100644 index 0000000000000..d8b5f84d1291a --- /dev/null +++ b/compiler/testData/codegen/box/callableReference/equality/kpropertyWithCapturingEquality.kt @@ -0,0 +1,40 @@ +// IGNORE_BACKEND: WASM +// WASM_MUTE_REASON: FAILS_IN_JS_IR +// IGNORE_BACKEND: JS, JS_IR +// IGNORE_BACKEND: JS_IR_ES6 +// FILE: test.kt + +val topLevelVal = "" +var topLevelVar = "" + +class Foo { + val memberVal = "" + var memberVar = "" +} + +fun box(): String { + val foo0 = Foo() + val foo1 = Foo() + + checkEqual(foo0::memberVal, foo0::memberVal) + checkEqual(foo0::memberVal, referenceMemberValFromOtherFile(foo0)) + checkEqual(foo0::memberVar, foo0::memberVar) + checkEqual(foo0::memberVar, referenceMemberVarFromOtherFile(foo0)) + + return "OK" +} + +fun checkEqual(x: Any, y: Any) { + if (x != y || y != x) throw AssertionError("$x and $y should be equal") + if (x.hashCode() != y.hashCode()) throw AssertionError("$x and $y should have the same hash code") +} + +fun checkNotEqual(x: Any, y: Any) { + if (x == y || y == x) throw AssertionError("$x and $y should NOT be equal") +} + +// FILE: otherFile.kt + +fun referenceMemberValFromOtherFile(foo: Foo) = foo::memberVal +fun referenceMemberVarFromOtherFile(foo: Foo) = foo::memberVar + diff --git a/compiler/testData/codegen/box/callableReference/equality/kpropertyWithCapturingInequality.kt b/compiler/testData/codegen/box/callableReference/equality/kpropertyWithCapturingInequality.kt new file mode 100644 index 0000000000000..d97145fd51eff --- /dev/null +++ b/compiler/testData/codegen/box/callableReference/equality/kpropertyWithCapturingInequality.kt @@ -0,0 +1,31 @@ +// IGNORE_BACKEND: JS +// FILE: test.kt + +val topLevelVal = "" +var topLevelVar = "" + +class Foo { + val memberVal = "" + var memberVar = "" +} + +fun box(): String { + val foo0 = Foo() + val foo1 = Foo() + + checkNotEqual(foo0::memberVal, Foo::memberVal) + checkNotEqual(foo0::memberVal, foo1::memberVal) + checkNotEqual(foo0::memberVar, Foo::memberVar) + checkNotEqual(foo0::memberVar, foo1::memberVar) + + return "OK" +} + +fun checkEqual(x: Any, y: Any) { + if (x != y || y != x) throw AssertionError("$x and $y should be equal") + if (x.hashCode() != y.hashCode()) throw AssertionError("$x and $y should have the same hash code") +} + +fun checkNotEqual(x: Any, y: Any) { + if (x == y || y == x) throw AssertionError("$x and $y should NOT be equal") +} diff --git a/compiler/testData/codegen/box/callableReference/equality/simpleEquality.kt b/compiler/testData/codegen/box/callableReference/equality/simpleEquality.kt index 6b5b8dd744511..d2e178308b5b9 100644 --- a/compiler/testData/codegen/box/callableReference/equality/simpleEquality.kt +++ b/compiler/testData/codegen/box/callableReference/equality/simpleEquality.kt @@ -14,11 +14,9 @@ fun checkNotEqual(x: Any, y: Any) { } class V { - val memberVal: String = "" fun memberFun(): String = "" } -val topLevelVar: String = "" fun topLevelFun(): String = "" fun box(): String { @@ -27,18 +25,12 @@ fun box(): String { checkEqual(::topLevelFun, ::topLevelFun) checkEqual(::topLevelFun, referenceTopLevelFunFromOtherFile()) - checkEqual(::topLevelVar, ::topLevelVar) - checkEqual(::topLevelVar, referenceTopLevelVarFromOtherFile()) checkEqual(V::memberFun, V::memberFun) checkEqual(v0::memberFun, v0::memberFun) - checkEqual(V::memberVal, V::memberVal) - checkEqual(v0::memberVal, v0::memberVal) checkNotEqual(v0::memberFun, V::memberFun) - checkNotEqual(v0::memberVal, V::memberVal) checkNotEqual(v0::memberFun, v1::memberFun) - checkNotEqual(v0::memberVal, v1::memberVal) return "OK" } @@ -46,4 +38,3 @@ fun box(): String { // FILE: fromOtherFile.kt fun referenceTopLevelFunFromOtherFile() = ::topLevelFun -fun referenceTopLevelVarFromOtherFile() = ::topLevelVar diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/JvmAbiConsistencyTestBoxGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/JvmAbiConsistencyTestBoxGenerated.java index ebe293b25bf9b..700ea031eaff4 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/JvmAbiConsistencyTestBoxGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/JvmAbiConsistencyTestBoxGenerated.java @@ -4950,6 +4950,24 @@ public void testExtensionReceiverVsDefault() { runTest("compiler/testData/codegen/box/callableReference/equality/extensionReceiverVsDefault.kt"); } + @Test + @TestMetadata("kproperty.kt") + public void testKproperty() { + runTest("compiler/testData/codegen/box/callableReference/equality/kproperty.kt"); + } + + @Test + @TestMetadata("kpropertyWithCapturingEquality.kt") + public void testKpropertyWithCapturingEquality() { + runTest("compiler/testData/codegen/box/callableReference/equality/kpropertyWithCapturingEquality.kt"); + } + + @Test + @TestMetadata("kpropertyWithCapturingInequality.kt") + public void testKpropertyWithCapturingInequality() { + runTest("compiler/testData/codegen/box/callableReference/equality/kpropertyWithCapturingInequality.kt"); + } + @Test @TestMetadata("noCoercionToUnitIfFunctionAlreadyReturnsUnit.kt") public void testNoCoercionToUnitIfFunctionAlreadyReturnsUnit() { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java index df3ca58b1e9fa..4bcb46798a9cd 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java @@ -4950,6 +4950,24 @@ public void testExtensionReceiverVsDefault() { runTest("compiler/testData/codegen/box/callableReference/equality/extensionReceiverVsDefault.kt"); } + @Test + @TestMetadata("kproperty.kt") + public void testKproperty() { + runTest("compiler/testData/codegen/box/callableReference/equality/kproperty.kt"); + } + + @Test + @TestMetadata("kpropertyWithCapturingEquality.kt") + public void testKpropertyWithCapturingEquality() { + runTest("compiler/testData/codegen/box/callableReference/equality/kpropertyWithCapturingEquality.kt"); + } + + @Test + @TestMetadata("kpropertyWithCapturingInequality.kt") + public void testKpropertyWithCapturingInequality() { + runTest("compiler/testData/codegen/box/callableReference/equality/kpropertyWithCapturingInequality.kt"); + } + @Test @TestMetadata("noCoercionToUnitIfFunctionAlreadyReturnsUnit.kt") public void testNoCoercionToUnitIfFunctionAlreadyReturnsUnit() { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java index c0fc3b2783a6b..20391aceebd0e 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenWithIrInlinerTestGenerated.java @@ -4950,6 +4950,24 @@ public void testExtensionReceiverVsDefault() { runTest("compiler/testData/codegen/box/callableReference/equality/extensionReceiverVsDefault.kt"); } + @Test + @TestMetadata("kproperty.kt") + public void testKproperty() { + runTest("compiler/testData/codegen/box/callableReference/equality/kproperty.kt"); + } + + @Test + @TestMetadata("kpropertyWithCapturingEquality.kt") + public void testKpropertyWithCapturingEquality() { + runTest("compiler/testData/codegen/box/callableReference/equality/kpropertyWithCapturingEquality.kt"); + } + + @Test + @TestMetadata("kpropertyWithCapturingInequality.kt") + public void testKpropertyWithCapturingInequality() { + runTest("compiler/testData/codegen/box/callableReference/equality/kpropertyWithCapturingInequality.kt"); + } + @Test @TestMetadata("noCoercionToUnitIfFunctionAlreadyReturnsUnit.kt") public void testNoCoercionToUnitIfFunctionAlreadyReturnsUnit() { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/inlineScopes/FirBlackBoxCodegenTestWithInlineScopesGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/inlineScopes/FirBlackBoxCodegenTestWithInlineScopesGenerated.java index bf2eb9149dcff..4dd7ea2247584 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/inlineScopes/FirBlackBoxCodegenTestWithInlineScopesGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/inlineScopes/FirBlackBoxCodegenTestWithInlineScopesGenerated.java @@ -4950,6 +4950,24 @@ public void testExtensionReceiverVsDefault() { runTest("compiler/testData/codegen/box/callableReference/equality/extensionReceiverVsDefault.kt"); } + @Test + @TestMetadata("kproperty.kt") + public void testKproperty() { + runTest("compiler/testData/codegen/box/callableReference/equality/kproperty.kt"); + } + + @Test + @TestMetadata("kpropertyWithCapturingEquality.kt") + public void testKpropertyWithCapturingEquality() { + runTest("compiler/testData/codegen/box/callableReference/equality/kpropertyWithCapturingEquality.kt"); + } + + @Test + @TestMetadata("kpropertyWithCapturingInequality.kt") + public void testKpropertyWithCapturingInequality() { + runTest("compiler/testData/codegen/box/callableReference/equality/kpropertyWithCapturingInequality.kt"); + } + @Test @TestMetadata("noCoercionToUnitIfFunctionAlreadyReturnsUnit.kt") public void testNoCoercionToUnitIfFunctionAlreadyReturnsUnit() { diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 608c8666abc00..bb38c9ef86669 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -4302,6 +4302,21 @@ public void testExtensionReceiverVsDefault() { runTest("compiler/testData/codegen/box/callableReference/equality/extensionReceiverVsDefault.kt"); } + @TestMetadata("kproperty.kt") + public void testKproperty() { + runTest("compiler/testData/codegen/box/callableReference/equality/kproperty.kt"); + } + + @TestMetadata("kpropertyWithCapturingEquality.kt") + public void testKpropertyWithCapturingEquality() { + runTest("compiler/testData/codegen/box/callableReference/equality/kpropertyWithCapturingEquality.kt"); + } + + @TestMetadata("kpropertyWithCapturingInequality.kt") + public void testKpropertyWithCapturingInequality() { + runTest("compiler/testData/codegen/box/callableReference/equality/kpropertyWithCapturingInequality.kt"); + } + @TestMetadata("noCoercionToUnitIfFunctionAlreadyReturnsUnit.kt") public void testNoCoercionToUnitIfFunctionAlreadyReturnsUnit() { runTest("compiler/testData/codegen/box/callableReference/equality/noCoercionToUnitIfFunctionAlreadyReturnsUnit.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java index f9f0721282b49..9aaf54f96a860 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsCodegenBoxTestGenerated.java @@ -3552,6 +3552,24 @@ public void testExtensionReceiverVsDefault() { runTest("compiler/testData/codegen/box/callableReference/equality/extensionReceiverVsDefault.kt"); } + @Test + @TestMetadata("kproperty.kt") + public void testKproperty() { + runTest("compiler/testData/codegen/box/callableReference/equality/kproperty.kt"); + } + + @Test + @TestMetadata("kpropertyWithCapturingEquality.kt") + public void testKpropertyWithCapturingEquality() { + runTest("compiler/testData/codegen/box/callableReference/equality/kpropertyWithCapturingEquality.kt"); + } + + @Test + @TestMetadata("kpropertyWithCapturingInequality.kt") + public void testKpropertyWithCapturingInequality() { + runTest("compiler/testData/codegen/box/callableReference/equality/kpropertyWithCapturingInequality.kt"); + } + @Test @TestMetadata("noCoercionToUnitIfFunctionAlreadyReturnsUnit.kt") public void testNoCoercionToUnitIfFunctionAlreadyReturnsUnit() { diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsES6CodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsES6CodegenBoxTestGenerated.java index 90bd75cc59514..73e37cc06435e 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsES6CodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsES6CodegenBoxTestGenerated.java @@ -3552,6 +3552,24 @@ public void testExtensionReceiverVsDefault() { runTest("compiler/testData/codegen/box/callableReference/equality/extensionReceiverVsDefault.kt"); } + @Test + @TestMetadata("kproperty.kt") + public void testKproperty() { + runTest("compiler/testData/codegen/box/callableReference/equality/kproperty.kt"); + } + + @Test + @TestMetadata("kpropertyWithCapturingEquality.kt") + public void testKpropertyWithCapturingEquality() { + runTest("compiler/testData/codegen/box/callableReference/equality/kpropertyWithCapturingEquality.kt"); + } + + @Test + @TestMetadata("kpropertyWithCapturingInequality.kt") + public void testKpropertyWithCapturingInequality() { + runTest("compiler/testData/codegen/box/callableReference/equality/kpropertyWithCapturingInequality.kt"); + } + @Test @TestMetadata("noCoercionToUnitIfFunctionAlreadyReturnsUnit.kt") public void testNoCoercionToUnitIfFunctionAlreadyReturnsUnit() { diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java index 60c815651e1d5..df9348291356f 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsCodegenBoxTestGenerated.java @@ -3552,6 +3552,24 @@ public void testExtensionReceiverVsDefault() { runTest("compiler/testData/codegen/box/callableReference/equality/extensionReceiverVsDefault.kt"); } + @Test + @TestMetadata("kproperty.kt") + public void testKproperty() { + runTest("compiler/testData/codegen/box/callableReference/equality/kproperty.kt"); + } + + @Test + @TestMetadata("kpropertyWithCapturingEquality.kt") + public void testKpropertyWithCapturingEquality() { + runTest("compiler/testData/codegen/box/callableReference/equality/kpropertyWithCapturingEquality.kt"); + } + + @Test + @TestMetadata("kpropertyWithCapturingInequality.kt") + public void testKpropertyWithCapturingInequality() { + runTest("compiler/testData/codegen/box/callableReference/equality/kpropertyWithCapturingInequality.kt"); + } + @Test @TestMetadata("noCoercionToUnitIfFunctionAlreadyReturnsUnit.kt") public void testNoCoercionToUnitIfFunctionAlreadyReturnsUnit() { diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java index feb68e67b5417..200eadb0a11a5 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrJsES6CodegenBoxTestGenerated.java @@ -3552,6 +3552,24 @@ public void testExtensionReceiverVsDefault() { runTest("compiler/testData/codegen/box/callableReference/equality/extensionReceiverVsDefault.kt"); } + @Test + @TestMetadata("kproperty.kt") + public void testKproperty() { + runTest("compiler/testData/codegen/box/callableReference/equality/kproperty.kt"); + } + + @Test + @TestMetadata("kpropertyWithCapturingEquality.kt") + public void testKpropertyWithCapturingEquality() { + runTest("compiler/testData/codegen/box/callableReference/equality/kpropertyWithCapturingEquality.kt"); + } + + @Test + @TestMetadata("kpropertyWithCapturingInequality.kt") + public void testKpropertyWithCapturingInequality() { + runTest("compiler/testData/codegen/box/callableReference/equality/kpropertyWithCapturingInequality.kt"); + } + @Test @TestMetadata("noCoercionToUnitIfFunctionAlreadyReturnsUnit.kt") public void testNoCoercionToUnitIfFunctionAlreadyReturnsUnit() { diff --git a/libraries/stdlib/wasm/internal/kotlin/wasm/internal/KPropertyImpl2.kt b/libraries/stdlib/wasm/internal/kotlin/wasm/internal/KPropertyImpl2.kt new file mode 100644 index 0000000000000..a237e2918b48b --- /dev/null +++ b/libraries/stdlib/wasm/internal/kotlin/wasm/internal/KPropertyImpl2.kt @@ -0,0 +1,214 @@ +/* + * Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +@file:Suppress("IMPLEMENTING_FUNCTION_INTERFACE") + +package kotlin.wasm.internal + +import kotlin.UnsupportedOperationException +import kotlin.reflect.* + +internal open class KProperty0Impl2( + override val name: String, + internal val container: String, + internal val capturedReceiver: Boolean, + val getter: () -> R, +) : KProperty0 { + override fun get(): R { + return getter() + } + + override fun invoke(): R { + return getter() + } + + override fun equals(other: Any?): Boolean { + if (this === other) return true + val otherKProperty = other as? KProperty0Impl2<*> ?: return false + return container == otherKProperty.container && + name == otherKProperty.name && + (!capturedReceiver || getter == otherKProperty.getter) + } + + override fun hashCode(): Int { + return name.hashCode() * 31 + container.hashCode() + } + + override fun toString(): String { + return "property $name (Kotlin reflection is not available)" + } +} + +internal open class KProperty1Impl2( + override val name: String, + internal val container: String, + internal val capturedReceiver: Boolean, + val getter: (T) -> R, +) : KProperty1 { + override fun get(receiver: T): R { + return getter(receiver) + } + + override fun invoke(p1: T): R { + return getter(p1) + } + + override fun equals(other: Any?): Boolean { + if (this === other) return true + val otherKProperty = other as? KProperty1Impl2<*, *> ?: return false + return container == otherKProperty.container && + name == otherKProperty.name && + (!capturedReceiver || getter == otherKProperty.getter) + } + + override fun hashCode(): Int { + return name.hashCode() * 31 + container.hashCode() + } + + override fun toString(): String { + return "property $name (Kotlin reflection is not available)" + } +} + +internal open class KProperty2Impl2( + override val name: String, + internal val container: String, + internal val capturedReceiver: Boolean, + val getter: (T1, T2) -> R, +) : + KProperty2 { + override fun get(receiver1: T1, receiver2: T2): R { + return getter(receiver1, receiver2) + } + + override fun invoke(p1: T1, p2: T2): R { + return getter(p1, p2) + } + + override fun equals(other: Any?): Boolean { + if (this === other) return true + val otherKProperty = other as? KProperty2Impl2<*, *, *> ?: return false + return container == otherKProperty.container && + name == otherKProperty.name && + (!capturedReceiver || getter == otherKProperty.getter) + } + + override fun hashCode(): Int { + return name.hashCode() * 31 + container.hashCode() + } + + override fun toString(): String { + return "property $name (Kotlin reflection is not available)" + } +} + +internal class KMutableProperty0Impl2( + name: String, + container: String, + capturedReceiver: Boolean, + getter: () -> R, + val setter: (R) -> Unit, +) : KProperty0Impl2(name, container, capturedReceiver, getter), KMutableProperty0 { + override fun set(value: R): Unit { + setter(value) + } + + override fun equals(other: Any?): Boolean { + if (this === other) return true + val otherKProperty = other as? KMutableProperty0Impl2<*> ?: return false + return container == otherKProperty.container && + name == otherKProperty.name && + (!capturedReceiver || getter == otherKProperty.getter && setter == otherKProperty.setter) + } + + override fun hashCode(): Int { + return name.hashCode() * 31 + container.hashCode() + } + + override fun toString(): String { + return "property $name (Kotlin reflection is not available)" + } +} + +internal class KMutableProperty1Impl2( + name: String, + container: String, + capturedReceiver: Boolean, + getter: (T) -> R, + val setter: (T, R) -> Unit, +) : KProperty1Impl2(name, container, capturedReceiver, getter), KMutableProperty1 { + override fun set(receiver: T, value: R): Unit { + setter(receiver, value) + } + + override fun equals(other: Any?): Boolean { + if (this === other) return true + val otherKProperty = other as? KMutableProperty1Impl2<*, *> ?: return false + return container == otherKProperty.container && + name == otherKProperty.name && + (!capturedReceiver || getter == otherKProperty.getter && setter == otherKProperty.setter) + } + + override fun hashCode(): Int { + return (name.hashCode() * 31 + container.hashCode()) + } + + override fun toString(): String { + return "property $name (Kotlin reflection is not available)" + } +} + +internal class KMutableProperty2Impl2( + name: String, + container: String, + capturedReceiver: Boolean, + getter: (T1, T2) -> R, + val setter: (T1, T2, R) -> Unit, +) : + KProperty2Impl2(name, container, capturedReceiver, getter), KMutableProperty2 { + override fun set(receiver1: T1, receiver2: T2, value: R): Unit { + setter(receiver1, receiver2, value) + } + + override fun equals(other: Any?): Boolean { + if (this === other) return true + val otherKProperty = other as? KMutableProperty2Impl2<*, *, *> ?: return false + return container == otherKProperty.container && + name == otherKProperty.name && + (!capturedReceiver || getter == otherKProperty.getter && setter == otherKProperty.setter) + } + + override fun hashCode(): Int { + return (name.hashCode() * 31 + container.hashCode()) + } + + override fun toString(): String { + return "property $name (Kotlin reflection is not available)" + } +} + +internal open class KLocalDelegatedPropertyImpl2(override val name: String) : KProperty0 { + override fun get(): R { + throw UnsupportedOperationException("Not supported for local property reference.") + } + + override fun invoke(): R { + throw UnsupportedOperationException("Not supported for local property reference.") + } + + override fun toString(): String { + return "property $name (Kotlin reflection is not available)" + } +} + +internal class KLocalDelegatedMutablePropertyImpl2(name: String) : KLocalDelegatedPropertyImpl2(name), KMutableProperty0 { + override fun set(value: R): Unit { + throw UnsupportedOperationException("Not supported for local property reference.") + } + + override fun toString(): String { + return "property $name (Kotlin reflection is not available)" + } +} \ No newline at end of file diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestGenerated.java index f0f6fca94bb8a..b10fd3c19c8f6 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestGenerated.java @@ -3632,6 +3632,24 @@ public void testExtensionReceiverVsDefault() { runTest("compiler/testData/codegen/box/callableReference/equality/extensionReceiverVsDefault.kt"); } + @Test + @TestMetadata("kproperty.kt") + public void testKproperty() { + runTest("compiler/testData/codegen/box/callableReference/equality/kproperty.kt"); + } + + @Test + @TestMetadata("kpropertyWithCapturingEquality.kt") + public void testKpropertyWithCapturingEquality() { + runTest("compiler/testData/codegen/box/callableReference/equality/kpropertyWithCapturingEquality.kt"); + } + + @Test + @TestMetadata("kpropertyWithCapturingInequality.kt") + public void testKpropertyWithCapturingInequality() { + runTest("compiler/testData/codegen/box/callableReference/equality/kpropertyWithCapturingInequality.kt"); + } + @Test @TestMetadata("noCoercionToUnitIfFunctionAlreadyReturnsUnit.kt") public void testNoCoercionToUnitIfFunctionAlreadyReturnsUnit() { diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestNoPLGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestNoPLGenerated.java index ad6c234eb011d..349473e7e865c 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestNoPLGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/FirNativeCodegenBoxTestNoPLGenerated.java @@ -3708,6 +3708,24 @@ public void testExtensionReceiverVsDefault() { runTest("compiler/testData/codegen/box/callableReference/equality/extensionReceiverVsDefault.kt"); } + @Test + @TestMetadata("kproperty.kt") + public void testKproperty() { + runTest("compiler/testData/codegen/box/callableReference/equality/kproperty.kt"); + } + + @Test + @TestMetadata("kpropertyWithCapturingEquality.kt") + public void testKpropertyWithCapturingEquality() { + runTest("compiler/testData/codegen/box/callableReference/equality/kpropertyWithCapturingEquality.kt"); + } + + @Test + @TestMetadata("kpropertyWithCapturingInequality.kt") + public void testKpropertyWithCapturingInequality() { + runTest("compiler/testData/codegen/box/callableReference/equality/kpropertyWithCapturingInequality.kt"); + } + @Test @TestMetadata("noCoercionToUnitIfFunctionAlreadyReturnsUnit.kt") public void testNoCoercionToUnitIfFunctionAlreadyReturnsUnit() { diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestGenerated.java index ff3a67e426ce8..259e9a724eb74 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestGenerated.java @@ -3556,6 +3556,24 @@ public void testExtensionReceiverVsDefault() { runTest("compiler/testData/codegen/box/callableReference/equality/extensionReceiverVsDefault.kt"); } + @Test + @TestMetadata("kproperty.kt") + public void testKproperty() { + runTest("compiler/testData/codegen/box/callableReference/equality/kproperty.kt"); + } + + @Test + @TestMetadata("kpropertyWithCapturingEquality.kt") + public void testKpropertyWithCapturingEquality() { + runTest("compiler/testData/codegen/box/callableReference/equality/kpropertyWithCapturingEquality.kt"); + } + + @Test + @TestMetadata("kpropertyWithCapturingInequality.kt") + public void testKpropertyWithCapturingInequality() { + runTest("compiler/testData/codegen/box/callableReference/equality/kpropertyWithCapturingInequality.kt"); + } + @Test @TestMetadata("noCoercionToUnitIfFunctionAlreadyReturnsUnit.kt") public void testNoCoercionToUnitIfFunctionAlreadyReturnsUnit() { diff --git a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestNoPLGenerated.java b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestNoPLGenerated.java index d6770eebb08a4..d10e9cbbafc0e 100644 --- a/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestNoPLGenerated.java +++ b/native/native.tests/tests-gen/org/jetbrains/kotlin/konan/test/blackbox/NativeCodegenBoxTestNoPLGenerated.java @@ -3633,6 +3633,24 @@ public void testExtensionReceiverVsDefault() { runTest("compiler/testData/codegen/box/callableReference/equality/extensionReceiverVsDefault.kt"); } + @Test + @TestMetadata("kproperty.kt") + public void testKproperty() { + runTest("compiler/testData/codegen/box/callableReference/equality/kproperty.kt"); + } + + @Test + @TestMetadata("kpropertyWithCapturingEquality.kt") + public void testKpropertyWithCapturingEquality() { + runTest("compiler/testData/codegen/box/callableReference/equality/kpropertyWithCapturingEquality.kt"); + } + + @Test + @TestMetadata("kpropertyWithCapturingInequality.kt") + public void testKpropertyWithCapturingInequality() { + runTest("compiler/testData/codegen/box/callableReference/equality/kpropertyWithCapturingInequality.kt"); + } + @Test @TestMetadata("noCoercionToUnitIfFunctionAlreadyReturnsUnit.kt") public void testNoCoercionToUnitIfFunctionAlreadyReturnsUnit() { diff --git a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmJsCodegenBoxTestGenerated.java b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmJsCodegenBoxTestGenerated.java index 07414ef164a96..764fe8be84e82 100644 --- a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmJsCodegenBoxTestGenerated.java +++ b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/FirWasmJsCodegenBoxTestGenerated.java @@ -3540,6 +3540,24 @@ public void testExtensionReceiverVsDefault() { runTest("compiler/testData/codegen/box/callableReference/equality/extensionReceiverVsDefault.kt"); } + @Test + @TestMetadata("kproperty.kt") + public void testKproperty() { + runTest("compiler/testData/codegen/box/callableReference/equality/kproperty.kt"); + } + + @Test + @TestMetadata("kpropertyWithCapturingEquality.kt") + public void testKpropertyWithCapturingEquality() { + runTest("compiler/testData/codegen/box/callableReference/equality/kpropertyWithCapturingEquality.kt"); + } + + @Test + @TestMetadata("kpropertyWithCapturingInequality.kt") + public void testKpropertyWithCapturingInequality() { + runTest("compiler/testData/codegen/box/callableReference/equality/kpropertyWithCapturingInequality.kt"); + } + @Test @TestMetadata("noCoercionToUnitIfFunctionAlreadyReturnsUnit.kt") public void testNoCoercionToUnitIfFunctionAlreadyReturnsUnit() { diff --git a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/K1WasmCodegenBoxTestGenerated.java b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/K1WasmCodegenBoxTestGenerated.java index 2fd87c45307a7..b8b22c3a49e36 100644 --- a/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/K1WasmCodegenBoxTestGenerated.java +++ b/wasm/wasm.tests/tests-gen/org/jetbrains/kotlin/wasm/test/K1WasmCodegenBoxTestGenerated.java @@ -3540,6 +3540,24 @@ public void testExtensionReceiverVsDefault() { runTest("compiler/testData/codegen/box/callableReference/equality/extensionReceiverVsDefault.kt"); } + @Test + @TestMetadata("kproperty.kt") + public void testKproperty() { + runTest("compiler/testData/codegen/box/callableReference/equality/kproperty.kt"); + } + + @Test + @TestMetadata("kpropertyWithCapturingEquality.kt") + public void testKpropertyWithCapturingEquality() { + runTest("compiler/testData/codegen/box/callableReference/equality/kpropertyWithCapturingEquality.kt"); + } + + @Test + @TestMetadata("kpropertyWithCapturingInequality.kt") + public void testKpropertyWithCapturingInequality() { + runTest("compiler/testData/codegen/box/callableReference/equality/kpropertyWithCapturingInequality.kt"); + } + @Test @TestMetadata("noCoercionToUnitIfFunctionAlreadyReturnsUnit.kt") public void testNoCoercionToUnitIfFunctionAlreadyReturnsUnit() {