JVM_IR KT-50171 add missing parent to temporary vals for proxy fun

This commit is contained in:
Dmitry Petrov
2021-12-11 11:05:03 +03:00
committed by Space
parent 627d838343
commit 81c805a754
6 changed files with 45 additions and 0 deletions
@@ -41231,6 +41231,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/sam/kt49226.kt");
}
@Test
@TestMetadata("kt50171.kt")
public void testKt50171() throws Exception {
runTest("compiler/testData/codegen/box/sam/kt50171.kt");
}
@Test
@TestMetadata("nonInlinedSamWrapper.kt")
public void testNonInlinedSamWrapper() throws Exception {
@@ -361,6 +361,7 @@ internal class FunctionReferenceLowering(private val context: JvmBackendContext)
isVar = false, isConst = false, isLateinit = false
)
tmpVal.initializer = initializer
tmpVal.parent = proxyFun.parent
temporaryVals.add(tmpVal)
return IrGetValueImpl(startOffset, endOffset, tmpVal.symbol)
}
+21
View File
@@ -0,0 +1,21 @@
// TARGET_BACKEND: JVM
// FULL_JDK
// SKIP_JDK6
import java.util.function.DoubleConsumer
var value: Double = 3.14
fun f() = {
g(::value::set)
}
fun g(consumer: DoubleConsumer) {
consumer.accept(42.0)
}
fun box(): String {
f()()
return if (value == 42.0) "OK" else "Fail"
}
@@ -40799,6 +40799,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/sam/kt49226.kt");
}
@Test
@TestMetadata("kt50171.kt")
public void testKt50171() throws Exception {
runTest("compiler/testData/codegen/box/sam/kt50171.kt");
}
@Test
@TestMetadata("nonInlinedSamWrapper.kt")
public void testNonInlinedSamWrapper() throws Exception {
@@ -41231,6 +41231,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/sam/kt49226.kt");
}
@Test
@TestMetadata("kt50171.kt")
public void testKt50171() throws Exception {
runTest("compiler/testData/codegen/box/sam/kt50171.kt");
}
@Test
@TestMetadata("nonInlinedSamWrapper.kt")
public void testNonInlinedSamWrapper() throws Exception {
@@ -32760,6 +32760,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/sam/kt49226.kt");
}
@TestMetadata("kt50171.kt")
public void testKt50171() throws Exception {
runTest("compiler/testData/codegen/box/sam/kt50171.kt");
}
@TestMetadata("nonInlinedSamWrapper.kt")
public void testNonInlinedSamWrapper() throws Exception {
runTest("compiler/testData/codegen/box/sam/nonInlinedSamWrapper.kt");