diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt index 2ded3b75a22..6594925380e 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/Fir2IrDeclarationStorage.kt @@ -304,13 +304,15 @@ class Fir2IrDeclarationStorage( endOffset: Int, type: IrType, parent: IrFunction, - name: Name? = null + name: Name? = null, + isCrossinline: Boolean = false, + isNoinline: Boolean = false, ): IrValueParameter { return irFactory.createValueParameter( startOffset, endOffset, IrDeclarationOrigin.DEFINED, IrValueParameterSymbolImpl(), name ?: SpecialNames.IMPLICIT_SET_PARAMETER, 0, type, varargElementType = null, - isCrossinline = false, isNoinline = false, + isCrossinline = isCrossinline, isNoinline = isNoinline, isHidden = false, isAssignable = false ).apply { this.parent = parent diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/lazy/Fir2IrLazyPropertyAccessor.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/lazy/Fir2IrLazyPropertyAccessor.kt index 1be1a089d69..7ba0c0d3e3f 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/lazy/Fir2IrLazyPropertyAccessor.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/lazy/Fir2IrLazyPropertyAccessor.kt @@ -94,7 +94,9 @@ class Fir2IrLazyPropertyAccessor( typeConverter, conversionTypeContext ), parent = this@Fir2IrLazyPropertyAccessor, - name = valueParameter?.name + name = valueParameter?.name, + isCrossinline = valueParameter?.isCrossinline == true, + isNoinline = valueParameter?.isNoinline == true ) ) } diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxInlineCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxInlineCodegenTestGenerated.java index 850ae5cde80..9514260f175 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxInlineCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeBlackBoxInlineCodegenTestGenerated.java @@ -3842,6 +3842,12 @@ public class FirLightTreeBlackBoxInlineCodegenTestGenerated extends AbstractFirL runTest("compiler/testData/codegen/boxInline/property/augAssignmentAndIncViaConvention.kt"); } + @Test + @TestMetadata("crossinlineFunctional.kt") + public void testCrossinlineFunctional() throws Exception { + runTest("compiler/testData/codegen/boxInline/property/crossinlineFunctional.kt"); + } + @Test @TestMetadata("fromObject.kt") public void testFromObject() throws Exception { @@ -3854,6 +3860,12 @@ public class FirLightTreeBlackBoxInlineCodegenTestGenerated extends AbstractFirL runTest("compiler/testData/codegen/boxInline/property/kt22649.kt"); } + @Test + @TestMetadata("noinlineFunctional.kt") + public void testNoinlineFunctional() throws Exception { + runTest("compiler/testData/codegen/boxInline/property/noinlineFunctional.kt"); + } + @Test @TestMetadata("property.kt") public void testProperty() throws Exception { diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeSerializeCompileKotlinAgainstInlineKotlinTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeSerializeCompileKotlinAgainstInlineKotlinTestGenerated.java index 9a9fa88a555..d4b5df2eabe 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeSerializeCompileKotlinAgainstInlineKotlinTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirLightTreeSerializeCompileKotlinAgainstInlineKotlinTestGenerated.java @@ -3842,6 +3842,12 @@ public class FirLightTreeSerializeCompileKotlinAgainstInlineKotlinTestGenerated runTest("compiler/testData/codegen/boxInline/property/augAssignmentAndIncViaConvention.kt"); } + @Test + @TestMetadata("crossinlineFunctional.kt") + public void testCrossinlineFunctional() throws Exception { + runTest("compiler/testData/codegen/boxInline/property/crossinlineFunctional.kt"); + } + @Test @TestMetadata("fromObject.kt") public void testFromObject() throws Exception { @@ -3854,6 +3860,12 @@ public class FirLightTreeSerializeCompileKotlinAgainstInlineKotlinTestGenerated runTest("compiler/testData/codegen/boxInline/property/kt22649.kt"); } + @Test + @TestMetadata("noinlineFunctional.kt") + public void testNoinlineFunctional() throws Exception { + runTest("compiler/testData/codegen/boxInline/property/noinlineFunctional.kt"); + } + @Test @TestMetadata("property.kt") public void testProperty() throws Exception { diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxInlineCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxInlineCodegenTestGenerated.java index eb9b60df98d..df228684f89 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxInlineCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiBlackBoxInlineCodegenTestGenerated.java @@ -3842,6 +3842,12 @@ public class FirPsiBlackBoxInlineCodegenTestGenerated extends AbstractFirPsiBlac runTest("compiler/testData/codegen/boxInline/property/augAssignmentAndIncViaConvention.kt"); } + @Test + @TestMetadata("crossinlineFunctional.kt") + public void testCrossinlineFunctional() throws Exception { + runTest("compiler/testData/codegen/boxInline/property/crossinlineFunctional.kt"); + } + @Test @TestMetadata("fromObject.kt") public void testFromObject() throws Exception { @@ -3854,6 +3860,12 @@ public class FirPsiBlackBoxInlineCodegenTestGenerated extends AbstractFirPsiBlac runTest("compiler/testData/codegen/boxInline/property/kt22649.kt"); } + @Test + @TestMetadata("noinlineFunctional.kt") + public void testNoinlineFunctional() throws Exception { + runTest("compiler/testData/codegen/boxInline/property/noinlineFunctional.kt"); + } + @Test @TestMetadata("property.kt") public void testProperty() throws Exception { diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiSerializeCompileKotlinAgainstInlineKotlinTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiSerializeCompileKotlinAgainstInlineKotlinTestGenerated.java index 567db59188b..fa47ec8f8f8 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiSerializeCompileKotlinAgainstInlineKotlinTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirPsiSerializeCompileKotlinAgainstInlineKotlinTestGenerated.java @@ -3842,6 +3842,12 @@ public class FirPsiSerializeCompileKotlinAgainstInlineKotlinTestGenerated extend runTest("compiler/testData/codegen/boxInline/property/augAssignmentAndIncViaConvention.kt"); } + @Test + @TestMetadata("crossinlineFunctional.kt") + public void testCrossinlineFunctional() throws Exception { + runTest("compiler/testData/codegen/boxInline/property/crossinlineFunctional.kt"); + } + @Test @TestMetadata("fromObject.kt") public void testFromObject() throws Exception { @@ -3854,6 +3860,12 @@ public class FirPsiSerializeCompileKotlinAgainstInlineKotlinTestGenerated extend runTest("compiler/testData/codegen/boxInline/property/kt22649.kt"); } + @Test + @TestMetadata("noinlineFunctional.kt") + public void testNoinlineFunctional() throws Exception { + runTest("compiler/testData/codegen/boxInline/property/noinlineFunctional.kt"); + } + @Test @TestMetadata("property.kt") public void testProperty() throws Exception { diff --git a/compiler/testData/codegen/boxInline/property/crossinlineFunctional.kt b/compiler/testData/codegen/boxInline/property/crossinlineFunctional.kt new file mode 100644 index 00000000000..86cc4919e1c --- /dev/null +++ b/compiler/testData/codegen/boxInline/property/crossinlineFunctional.kt @@ -0,0 +1,27 @@ +// TARGET_BACKEND: JVM_IR +// FILE: 1.kt +package test + +class C { + var x: () -> Unit + inline get() = {} + inline set(crossinline value) { + bar { value() } + } + + fun bar(i: I) = i.foo() +} + +fun interface I { + fun foo() +} + +// FILE: 2.kt +import test.* + +fun box(): String { + var result = "fail" + val c = C() + c.x = { result = "OK" } + return result +} diff --git a/compiler/testData/codegen/boxInline/property/noinlineFunctional.kt b/compiler/testData/codegen/boxInline/property/noinlineFunctional.kt new file mode 100644 index 00000000000..f5e2b8ad113 --- /dev/null +++ b/compiler/testData/codegen/boxInline/property/noinlineFunctional.kt @@ -0,0 +1,28 @@ +// TARGET_BACKEND: JVM_IR +// IGNORE_BACKEND_MULTI_MODULE: JVM_MULTI_MODULE_IR_AGAINST_OLD +// FILE: 1.kt +package test + +class C { + var x: () -> Unit + inline get() = {} + inline set(noinline value) { + bar(value) + } + + fun bar(i: I) = i.foo() +} + +fun interface I { + fun foo() +} + +// FILE: 2.kt +import test.* + +fun box(): String { + var result = "fail" + val c = C() + c.x = { result = "OK" } + return result +} diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxInlineCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxInlineCodegenTestGenerated.java index b1fef848a23..f3aca31ef0e 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxInlineCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxInlineCodegenTestGenerated.java @@ -3842,6 +3842,12 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli runTest("compiler/testData/codegen/boxInline/property/augAssignmentAndIncViaConvention.kt"); } + @Test + @TestMetadata("crossinlineFunctional.kt") + public void testCrossinlineFunctional() throws Exception { + runTest("compiler/testData/codegen/boxInline/property/crossinlineFunctional.kt"); + } + @Test @TestMetadata("fromObject.kt") public void testFromObject() throws Exception { @@ -3854,6 +3860,12 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli runTest("compiler/testData/codegen/boxInline/property/kt22649.kt"); } + @Test + @TestMetadata("noinlineFunctional.kt") + public void testNoinlineFunctional() throws Exception { + runTest("compiler/testData/codegen/boxInline/property/noinlineFunctional.kt"); + } + @Test @TestMetadata("property.kt") public void testProperty() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrCompileKotlinAgainstInlineKotlinTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrCompileKotlinAgainstInlineKotlinTestGenerated.java index 5ce58059630..2bd130bd564 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrCompileKotlinAgainstInlineKotlinTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrCompileKotlinAgainstInlineKotlinTestGenerated.java @@ -3842,6 +3842,12 @@ public class IrCompileKotlinAgainstInlineKotlinTestGenerated extends AbstractIrC runTest("compiler/testData/codegen/boxInline/property/augAssignmentAndIncViaConvention.kt"); } + @Test + @TestMetadata("crossinlineFunctional.kt") + public void testCrossinlineFunctional() throws Exception { + runTest("compiler/testData/codegen/boxInline/property/crossinlineFunctional.kt"); + } + @Test @TestMetadata("fromObject.kt") public void testFromObject() throws Exception { @@ -3854,6 +3860,12 @@ public class IrCompileKotlinAgainstInlineKotlinTestGenerated extends AbstractIrC runTest("compiler/testData/codegen/boxInline/property/kt22649.kt"); } + @Test + @TestMetadata("noinlineFunctional.kt") + public void testNoinlineFunctional() throws Exception { + runTest("compiler/testData/codegen/boxInline/property/noinlineFunctional.kt"); + } + @Test @TestMetadata("property.kt") public void testProperty() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrSerializeCompileKotlinAgainstInlineKotlinTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrSerializeCompileKotlinAgainstInlineKotlinTestGenerated.java index 3cbcffdc8f8..7d4aa8633a6 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrSerializeCompileKotlinAgainstInlineKotlinTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrSerializeCompileKotlinAgainstInlineKotlinTestGenerated.java @@ -3842,6 +3842,12 @@ public class IrSerializeCompileKotlinAgainstInlineKotlinTestGenerated extends Ab runTest("compiler/testData/codegen/boxInline/property/augAssignmentAndIncViaConvention.kt"); } + @Test + @TestMetadata("crossinlineFunctional.kt") + public void testCrossinlineFunctional() throws Exception { + runTest("compiler/testData/codegen/boxInline/property/crossinlineFunctional.kt"); + } + @Test @TestMetadata("fromObject.kt") public void testFromObject() throws Exception { @@ -3854,6 +3860,12 @@ public class IrSerializeCompileKotlinAgainstInlineKotlinTestGenerated extends Ab runTest("compiler/testData/codegen/boxInline/property/kt22649.kt"); } + @Test + @TestMetadata("noinlineFunctional.kt") + public void testNoinlineFunctional() throws Exception { + runTest("compiler/testData/codegen/boxInline/property/noinlineFunctional.kt"); + } + @Test @TestMetadata("property.kt") public void testProperty() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmIrAgainstOldBoxInlineTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmIrAgainstOldBoxInlineTestGenerated.java index 23d6cb3a588..0d1a89be085 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmIrAgainstOldBoxInlineTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/JvmIrAgainstOldBoxInlineTestGenerated.java @@ -3842,6 +3842,12 @@ public class JvmIrAgainstOldBoxInlineTestGenerated extends AbstractJvmIrAgainstO runTest("compiler/testData/codegen/boxInline/property/augAssignmentAndIncViaConvention.kt"); } + @Test + @TestMetadata("crossinlineFunctional.kt") + public void testCrossinlineFunctional() throws Exception { + runTest("compiler/testData/codegen/boxInline/property/crossinlineFunctional.kt"); + } + @Test @TestMetadata("fromObject.kt") public void testFromObject() throws Exception { @@ -3854,6 +3860,12 @@ public class JvmIrAgainstOldBoxInlineTestGenerated extends AbstractJvmIrAgainstO runTest("compiler/testData/codegen/boxInline/property/kt22649.kt"); } + @Test + @TestMetadata("noinlineFunctional.kt") + public void testNoinlineFunctional() throws Exception { + runTest("compiler/testData/codegen/boxInline/property/noinlineFunctional.kt"); + } + @Test @TestMetadata("property.kt") public void testProperty() throws Exception {