Generate synthetic functions for local functions with default values, by
re-ordering the lowering phases. The changes in InterfaceLowering are necessary so that IrElements that target the removed functions are re-targeted to the new functions in DefaultImpls. This affects local functions in interface functions since now LocalDeclarationsLowering comes before InterfaceLowering.
This commit is contained in:
committed by
max-kammerer
parent
d2f1852c5e
commit
1abdf0561a
Vendored
+1
-1
@@ -1,5 +1,5 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
// IGNORE_BACKEND: JVM_IR, JS
|
||||
// IGNORE_BACKEND: JS
|
||||
|
||||
fun call0(f: (String) -> String, x: String): String = f(x)
|
||||
fun call1(f: (String, String) -> String, x: String, y: String): String = f(x, y)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
fun box(): String {
|
||||
val x = "OK"
|
||||
fun bar(y: String = x): String = y
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
fun box() : String {
|
||||
|
||||
|
||||
fun local(i: Int = 1) : Int {
|
||||
return i
|
||||
}
|
||||
|
||||
return if (local() != 1) "fail" else "OK"
|
||||
}
|
||||
if (local() != 1) return "Fail 1"
|
||||
if (local(2) != 2) return "Fail 2"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
class C() {
|
||||
fun box(): Int {
|
||||
fun local(i: Int = 1): Int {
|
||||
return i
|
||||
}
|
||||
return local()
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return if (C().box() != 1) "fail" else "OK"
|
||||
}
|
||||
-1
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
fun foo(): String {
|
||||
fun bar(x: String, y: String = x): String {
|
||||
return y
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// !JVM_DEFAULT_MODE: enable
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// TARGET_BACKEND: JVM
|
||||
// JVM_TARGET: 1.8
|
||||
// WITH_RUNTIME
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// !JVM_DEFAULT_MODE: enable
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// TARGET_BACKEND: JVM
|
||||
// JVM_TARGET: 1.8
|
||||
// WITH_RUNTIME
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// !JVM_DEFAULT_MODE: enable
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// TARGET_BACKEND: JVM
|
||||
// JVM_TARGET: 1.8
|
||||
// WITH_RUNTIME
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// !JVM_DEFAULT_MODE: enable
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// TARGET_BACKEND: JVM
|
||||
// JVM_TARGET: 1.8
|
||||
// WITH_RUNTIME
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// !JVM_DEFAULT_MODE: enable
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// TARGET_BACKEND: JVM
|
||||
// JVM_TARGET: 1.8
|
||||
// WITH_RUNTIME
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
fun box(): String {
|
||||
val s = "captured";
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// FILE: 1.kt
|
||||
|
||||
package test
|
||||
|
||||
Reference in New Issue
Block a user