FIR2IR: load property setter noinline/crossinline flags

#KT-56234 Fixed
This commit is contained in:
pyos
2023-02-06 10:34:15 +01:00
committed by Space Team
parent 8ff4af034a
commit 7420008af9
12 changed files with 158 additions and 3 deletions
@@ -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
@@ -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
)
)
}
@@ -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 {
@@ -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 {
@@ -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 {
@@ -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 {
@@ -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
}
@@ -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
}
@@ -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 {
@@ -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 {
@@ -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 {
@@ -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 {