Additional constructor call normalization tests
This commit is contained in:
+14
@@ -0,0 +1,14 @@
|
|||||||
|
// TARGET_BACKEND: JVM
|
||||||
|
// WITH_RUNTIME
|
||||||
|
// KOTLIN_CONFIGURATION_FLAGS: CONSTRUCTOR_CALL_NORMALIZATION_MODE=enable
|
||||||
|
open class A(val s: String)
|
||||||
|
|
||||||
|
inline fun test(crossinline z: () -> String): String {
|
||||||
|
return object : A(listOf(1).map { it.toString() }.joinToString()) {
|
||||||
|
val value = z()
|
||||||
|
}.value
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
return test { "OK" }
|
||||||
|
}
|
||||||
+41
@@ -0,0 +1,41 @@
|
|||||||
|
// TARGET_BACKEND: JVM
|
||||||
|
// WITH_RUNTIME
|
||||||
|
// KOTLIN_CONFIGURATION_FLAGS: CONSTRUCTOR_CALL_NORMALIZATION_MODE=enable
|
||||||
|
// FILE: test.kt
|
||||||
|
fun box(): String {
|
||||||
|
Foo(
|
||||||
|
logged("i", listOf(1, 2, 3).map { it + 1 }.first()),
|
||||||
|
logged("j",
|
||||||
|
Foo(
|
||||||
|
logged("k", listOf(1, 2, 3).map { it + 1 }.first()),
|
||||||
|
null
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
val result = log.toString()
|
||||||
|
if (result != "ik<clinit><init>j<init>") return "Fail: '$result'"
|
||||||
|
|
||||||
|
return "OK"
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: util.kt
|
||||||
|
val log = StringBuilder()
|
||||||
|
|
||||||
|
fun <T> logged(msg: String, value: T): T {
|
||||||
|
log.append(msg)
|
||||||
|
return value
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: Foo.kt
|
||||||
|
class Foo(i: Int, j: Foo?) {
|
||||||
|
init {
|
||||||
|
log.append("<init>")
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
init {
|
||||||
|
log.append("<clinit>")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+12
@@ -4337,6 +4337,18 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("loopInInlineFunInSuperConstructorCallWithEnabledNormalization.kt")
|
||||||
|
public void testLoopInInlineFunInSuperConstructorCallWithEnabledNormalization() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/constructorCall/loopInInlineFunInSuperConstructorCallWithEnabledNormalization.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("loopInInlineFunWithEnabledNormalization.kt")
|
||||||
|
public void testLoopInInlineFunWithEnabledNormalization() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/constructorCall/loopInInlineFunWithEnabledNormalization.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("nestedConstructorCallWithJumpOutInConstructorArguments.kt")
|
@TestMetadata("nestedConstructorCallWithJumpOutInConstructorArguments.kt")
|
||||||
public void testNestedConstructorCallWithJumpOutInConstructorArguments() throws Exception {
|
public void testNestedConstructorCallWithJumpOutInConstructorArguments() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/constructorCall/nestedConstructorCallWithJumpOutInConstructorArguments.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/constructorCall/nestedConstructorCallWithJumpOutInConstructorArguments.kt");
|
||||||
|
|||||||
@@ -4337,6 +4337,18 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("loopInInlineFunInSuperConstructorCallWithEnabledNormalization.kt")
|
||||||
|
public void testLoopInInlineFunInSuperConstructorCallWithEnabledNormalization() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/constructorCall/loopInInlineFunInSuperConstructorCallWithEnabledNormalization.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("loopInInlineFunWithEnabledNormalization.kt")
|
||||||
|
public void testLoopInInlineFunWithEnabledNormalization() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/constructorCall/loopInInlineFunWithEnabledNormalization.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("nestedConstructorCallWithJumpOutInConstructorArguments.kt")
|
@TestMetadata("nestedConstructorCallWithJumpOutInConstructorArguments.kt")
|
||||||
public void testNestedConstructorCallWithJumpOutInConstructorArguments() throws Exception {
|
public void testNestedConstructorCallWithJumpOutInConstructorArguments() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/constructorCall/nestedConstructorCallWithJumpOutInConstructorArguments.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/constructorCall/nestedConstructorCallWithJumpOutInConstructorArguments.kt");
|
||||||
|
|||||||
@@ -4337,6 +4337,18 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("loopInInlineFunInSuperConstructorCallWithEnabledNormalization.kt")
|
||||||
|
public void testLoopInInlineFunInSuperConstructorCallWithEnabledNormalization() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/constructorCall/loopInInlineFunInSuperConstructorCallWithEnabledNormalization.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("loopInInlineFunWithEnabledNormalization.kt")
|
||||||
|
public void testLoopInInlineFunWithEnabledNormalization() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/constructorCall/loopInInlineFunWithEnabledNormalization.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("nestedConstructorCallWithJumpOutInConstructorArguments.kt")
|
@TestMetadata("nestedConstructorCallWithJumpOutInConstructorArguments.kt")
|
||||||
public void testNestedConstructorCallWithJumpOutInConstructorArguments() throws Exception {
|
public void testNestedConstructorCallWithJumpOutInConstructorArguments() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/constructorCall/nestedConstructorCallWithJumpOutInConstructorArguments.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/constructorCall/nestedConstructorCallWithJumpOutInConstructorArguments.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user