Remove -Xnormalize-constructor-calls
Constructor call normalization is enabled by default since 1.3.
This commit is contained in:
+2
-3
@@ -1,4 +1,3 @@
|
||||
// !LANGUAGE: -NormalizeConstructorCalls
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
// FILE: test.kt
|
||||
@@ -13,7 +12,7 @@ fun box(): String {
|
||||
}
|
||||
|
||||
val result = log.toString()
|
||||
if (result != "<clinit>ij<init>") return "Fail: '$result'"
|
||||
if (result != "ij<clinit><init>") return "Fail: '$result'"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -37,4 +36,4 @@ class Foo(i: Int, j: Int) {
|
||||
log.append("<clinit>")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-3
@@ -1,4 +1,3 @@
|
||||
// !LANGUAGE: -NormalizeConstructorCalls
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
// FILE: test.kt
|
||||
@@ -14,7 +13,7 @@ fun box(): String {
|
||||
}
|
||||
|
||||
val result = log.toString()
|
||||
if (result != "<clinit>ij<init>") return "Fail: '$result'"
|
||||
if (result != "ij<clinit><init>") return "Fail: '$result'"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -38,4 +37,4 @@ class Foo(i: Int, j: Int) {
|
||||
log.append("<clinit>")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-2
@@ -1,4 +1,3 @@
|
||||
// !LANGUAGE: -NormalizeConstructorCalls
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
inline fun ok(): String {
|
||||
@@ -10,7 +9,7 @@ fun box(): String {
|
||||
if (ok != "OK") return "Fail: $ok"
|
||||
|
||||
val r = log.toString()
|
||||
if (r != "<clinit>;bar;<init>;foo;") return "Fail: '$r'"
|
||||
if (r != "bar;<clinit>;<init>;foo;") return "Fail: '$r'"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
|
||||
-1
@@ -1,6 +1,5 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
// CONSTRUCTOR_CALL_NORMALIZATION_MODE: enable
|
||||
// FILE: test.kt
|
||||
fun box(): String {
|
||||
Foo(
|
||||
+1
-2
@@ -1,4 +1,3 @@
|
||||
// !LANGUAGE: -NormalizeConstructorCalls
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
// FILE: test.kt
|
||||
@@ -14,7 +13,7 @@ fun box(): String {
|
||||
)
|
||||
|
||||
val result = log.toString()
|
||||
if (result != "<clinit>ik<init>j<init>") return "Fail: '$result'"
|
||||
if (result != "ik<clinit><init>j<init>") return "Fail: '$result'"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
|
||||
compiler/testData/codegen/box/constructorCall/inlineFunInConstructorCallWithDisabledNormalization.kt
Vendored
-41
@@ -1,41 +0,0 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
// CONSTRUCTOR_CALL_NORMALIZATION_MODE: disable
|
||||
// FILE: test.kt
|
||||
fun box(): String {
|
||||
Foo(
|
||||
logged("i", 1.let { it }),
|
||||
logged("j",
|
||||
Foo(
|
||||
logged("k", 2.let { it }),
|
||||
null
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
val result = log.toString()
|
||||
if (result != "<clinit>ik<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>")
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
-41
@@ -1,41 +0,0 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
// CONSTRUCTOR_CALL_NORMALIZATION_MODE: preserve-class-initialization
|
||||
// FILE: test.kt
|
||||
fun box(): String {
|
||||
Foo(
|
||||
logged("i", 1.let { it }),
|
||||
logged("j",
|
||||
Foo(
|
||||
logged("k", 2.let { it }),
|
||||
null
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
val result = log.toString()
|
||||
if (result != "<clinit>ik<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>")
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-3
@@ -1,4 +1,3 @@
|
||||
// !LANGUAGE: -NormalizeConstructorCalls
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
// FILE: test.kt
|
||||
@@ -9,7 +8,7 @@ fun box(): String {
|
||||
)
|
||||
|
||||
val result = log.toString()
|
||||
if (result != "Foo.<clinit>;i;j;Foo.<init>;Inner.<init>;") return "Fail: '$result'"
|
||||
if (result != "i;j;Foo.<clinit>;Foo.<init>;Inner.<init>;") return "Fail: '$result'"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -41,4 +40,4 @@ class Outer {
|
||||
log.append("Inner.<init>;")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-2
@@ -1,4 +1,3 @@
|
||||
// !LANGUAGE: -NormalizeConstructorCalls
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
// FILE: test.kt
|
||||
@@ -15,7 +14,7 @@ fun box(): String {
|
||||
)
|
||||
|
||||
val result = log.toString()
|
||||
if (result != "Foo.<clinit>;i;j;Foo.<init>;Local.<init>;") return "Fail: '$result'"
|
||||
if (result != "i;j;Foo.<clinit>;Foo.<init>;Local.<init>;") return "Fail: '$result'"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
|
||||
-1
@@ -1,6 +1,5 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
// CONSTRUCTOR_CALL_NORMALIZATION_MODE: enable
|
||||
// FILE: test.kt
|
||||
fun box(): String {
|
||||
Foo(
|
||||
+1
-2
@@ -1,4 +1,3 @@
|
||||
// !LANGUAGE: +NormalizeConstructorCalls
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
open class A(val s: String)
|
||||
@@ -11,4 +10,4 @@ inline fun test(crossinline z: () -> String): String {
|
||||
|
||||
fun box(): String {
|
||||
return test { "OK" }
|
||||
}
|
||||
}
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
// 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" }
|
||||
}
|
||||
+2
-3
@@ -1,4 +1,3 @@
|
||||
// !LANGUAGE: -NormalizeConstructorCalls
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
// FILE: test.kt
|
||||
@@ -17,7 +16,7 @@ fun box(): String {
|
||||
}
|
||||
|
||||
val result = log.toString()
|
||||
if (result != "<clinit>ij<init>") return "Fail: '$result'"
|
||||
if (result != "ij<clinit><init>") return "Fail: '$result'"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -41,4 +40,4 @@ class Foo(i: Int, j: Int) {
|
||||
log.append("<clinit>")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-2
@@ -1,4 +1,3 @@
|
||||
// !LANGUAGE: -NormalizeConstructorCalls
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_RUNTIME
|
||||
// FILE: test.kt
|
||||
@@ -9,7 +8,7 @@ fun box(): String {
|
||||
)
|
||||
|
||||
val result = log.toString()
|
||||
if (result != "<clinit>ij<init>") return "Fail: '$result'"
|
||||
if (result != "ij<clinit><init>") return "Fail: '$result'"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user