[IR] Fix remapping of arguments in LocalDeclarationsLowering.
It only remapped arguments for IrGetValue and not for IrSetValue. This is hitting Compose which has non-standard default argument handling.
This commit is contained in:
committed by
Alexander Udalov
parent
167e60b9fb
commit
a7efa5c98b
+17
@@ -305,6 +305,23 @@ class LocalDeclarationsLowering(
|
||||
return expression
|
||||
}
|
||||
|
||||
override fun visitSetValue(expression: IrSetValue): IrExpression {
|
||||
expression.transformChildrenVoid(this)
|
||||
|
||||
val declaration = expression.symbol.owner
|
||||
oldParameterToNew[declaration]?.let {
|
||||
return IrSetValueImpl(
|
||||
expression.startOffset,
|
||||
expression.endOffset,
|
||||
it.type,
|
||||
it.symbol,
|
||||
expression.value,
|
||||
expression.origin
|
||||
)
|
||||
}
|
||||
return expression
|
||||
}
|
||||
|
||||
override fun visitCall(expression: IrCall): IrExpression {
|
||||
expression.transformChildrenVoid(this)
|
||||
|
||||
|
||||
-4
@@ -346,10 +346,6 @@ class ExpressionCodegen(
|
||||
}
|
||||
|
||||
private fun writeValueParameterInLocalVariableTable(param: IrValueParameter, startLabel: Label, endLabel: Label, isReceiver: Boolean) {
|
||||
// TODO: old code has a special treatment for destructuring lambda parameters.
|
||||
// There is no (easy) way to reproduce it with IR structures.
|
||||
// Does not show up in tests, but might come to bite us at some point.
|
||||
|
||||
// If the parameter is an extension receiver parameter or a captured extension receiver from enclosing,
|
||||
// then generate name accordingly.
|
||||
val name = if (param.origin == BOUND_RECEIVER_PARAMETER || isReceiver) {
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
fun foo(s: String = "O") = s
|
||||
|
||||
fun box() = foo() + foo("K")
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
inline fun foo(s: String = "O") = s
|
||||
|
||||
fun box() = foo() + foo("K")
|
||||
@@ -0,0 +1,4 @@
|
||||
fun box(): String {
|
||||
fun foo(s: String = "O") = s
|
||||
return foo() + foo("K")
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* Copyright 2010-2019 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.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.codegen.ir
|
||||
|
||||
import org.jetbrains.kotlin.codegen.AbstractBytecodeTextTest
|
||||
import org.jetbrains.kotlin.test.TargetBackend
|
||||
|
||||
abstract class AbstractComposeLikeIrBytecodeTextTest : AbstractBytecodeTextTest() {
|
||||
override val backend = TargetBackend.JVM_IR
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
/*
|
||||
* Copyright 2010-2020 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.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.codegen.ir
|
||||
|
||||
Generated
+46
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright 2010-2020 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.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.codegen.ir;
|
||||
|
||||
import com.intellij.testFramework.TestDataPath;
|
||||
import org.jetbrains.kotlin.test.JUnit3RunnerWithInners;
|
||||
import org.jetbrains.kotlin.test.KotlinTestUtils;
|
||||
import org.jetbrains.kotlin.test.TargetBackend;
|
||||
import org.jetbrains.kotlin.test.TestMetadata;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("compiler/testData/codegen/composeLike")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public class ComposeLikeIrBytecodeTextTestGenerated extends AbstractComposeLikeIrBytecodeTextTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInComposeLike() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/composeLike"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("default.kt")
|
||||
public void testDefault() throws Exception {
|
||||
runTest("compiler/testData/codegen/composeLike/default.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("defaultInline.kt")
|
||||
public void testDefaultInline() throws Exception {
|
||||
runTest("compiler/testData/codegen/composeLike/defaultInline.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("defaultLocal.kt")
|
||||
public void testDefaultLocal() throws Exception {
|
||||
runTest("compiler/testData/codegen/composeLike/defaultLocal.kt");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user