[JVM_IR] Don't add synthetic accessor when processing function reference
The issue appeared after code refactoring. Originally we didn't save generated accessor for symbols in `IrFunctionReference`. These symbols will be processed in their own turn. #KT-59079 Fixed
This commit is contained in:
+6
@@ -52325,6 +52325,12 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr
|
||||
runTest("compiler/testData/codegen/box/valueClasses/inlineFunctions.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt59079.kt")
|
||||
public void testKt59079() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/valueClasses/kt59079.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("mfvcAndIcInsideConstructorsOfEachOther.kt")
|
||||
public void testMfvcAndIcInsideConstructorsOfEachOther() throws Exception {
|
||||
|
||||
+6
@@ -52325,6 +52325,12 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo
|
||||
runTest("compiler/testData/codegen/box/valueClasses/inlineFunctions.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt59079.kt")
|
||||
public void testKt59079() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/valueClasses/kt59079.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("mfvcAndIcInsideConstructorsOfEachOther.kt")
|
||||
public void testMfvcAndIcInsideConstructorsOfEachOther() throws Exception {
|
||||
|
||||
+6
-8
@@ -276,14 +276,12 @@ private class SyntheticAccessorTransformer(
|
||||
accessorGenerator.isOrShouldBeHiddenAsSealedClassConstructor(function) -> accessorGenerator.getSyntheticConstructorOfSealedClass(function)
|
||||
else -> return super.visitFunctionReference(expression)
|
||||
}
|
||||
generatedAccessor.symbol.save().owner.let { accessor ->
|
||||
expression.transformChildrenVoid()
|
||||
return IrFunctionReferenceImpl(
|
||||
expression.startOffset, expression.endOffset, expression.type,
|
||||
accessor.symbol, accessor.typeParameters.size,
|
||||
accessor.valueParameters.size, accessor.symbol, expression.origin
|
||||
)
|
||||
}
|
||||
expression.transformChildrenVoid()
|
||||
return IrFunctionReferenceImpl(
|
||||
expression.startOffset, expression.endOffset, expression.type,
|
||||
generatedAccessor.symbol, generatedAccessor.typeParameters.size,
|
||||
generatedAccessor.valueParameters.size, generatedAccessor.symbol, expression.origin
|
||||
)
|
||||
}
|
||||
|
||||
return super.visitFunctionReference(expression)
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
// WITH_STDLIB
|
||||
// LANGUAGE: +ValueClasses
|
||||
// TARGET_BACKEND: JVM_IR
|
||||
|
||||
// FILE: a.kt
|
||||
|
||||
@JvmInline
|
||||
value class IC(val x: String)
|
||||
|
||||
class C(val ic: IC)
|
||||
|
||||
// FILE: b.kt
|
||||
|
||||
fun foo(action: (ic: IC) -> C): C {
|
||||
return action(IC("OK"))
|
||||
}
|
||||
|
||||
fun test(): C {
|
||||
return foo(::C)
|
||||
}
|
||||
|
||||
// FILE: c.kt
|
||||
|
||||
fun box(): String {
|
||||
return test().ic.x
|
||||
}
|
||||
+6
@@ -52325,6 +52325,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/valueClasses/inlineFunctions.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt59079.kt")
|
||||
public void testKt59079() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/valueClasses/kt59079.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("mfvcAndIcInsideConstructorsOfEachOther.kt")
|
||||
public void testMfvcAndIcInsideConstructorsOfEachOther() throws Exception {
|
||||
|
||||
+6
@@ -52325,6 +52325,12 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack
|
||||
runTest("compiler/testData/codegen/box/valueClasses/inlineFunctions.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt59079.kt")
|
||||
public void testKt59079() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/valueClasses/kt59079.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("mfvcAndIcInsideConstructorsOfEachOther.kt")
|
||||
public void testMfvcAndIcInsideConstructorsOfEachOther() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user