Fix for KT-7544: Backend fails when inlining nested calls with reified type parameter and default value parameter

#KT-7544 Fixed
This commit is contained in:
Michael Bogdanov
2015-04-22 15:45:14 +03:00
parent 72648d305e
commit 53b8a1d56e
20 changed files with 234 additions and 30 deletions
@@ -0,0 +1,6 @@
//NO_CHECK_LAMBDA_INLINING
import test.*
fun box(): String {
return bar {"OK"} ()
}
@@ -0,0 +1,7 @@
package test
inline fun bar(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) y: () -> String) = {
call(y)
}
public inline fun <T> call(f: () -> T): T = f()
@@ -0,0 +1,6 @@
//NO_CHECK_LAMBDA_INLINING
import test.*
fun box(): String {
return bar {"OK"} ()
}
@@ -0,0 +1,7 @@
package test
inline fun bar(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) y: () -> String) = {
{ { call(y) }() }()
}
public inline fun <T> call(f: () -> T): T = f()
@@ -0,0 +1,12 @@
//NO_CHECK_LAMBDA_INLINING
import test.*
fun box(): String {
val bar1 = bar {"123"} ()
val bar2 = bar2 { "1234" } ()
return if (bar1 == "123" && bar2 == "1234") "OK" else "fail: $bar1 $bar2"
}
inline fun bar2(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) y: () -> String) = {
{ { call(y) }() }()
}
@@ -0,0 +1,7 @@
package test
inline fun bar(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) y: () -> String) = {
{ { call(y) }() }()
}
public inline fun <T> call(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) f: () -> T): T = {{ f() }()}()
@@ -0,0 +1,6 @@
//NO_CHECK_LAMBDA_INLINING
import test.*
fun box(): String {
return bar { "OK" }.run()
}
@@ -0,0 +1,17 @@
package test
trait A<T> {
fun run(): T;
}
inline fun bar(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) y: () -> String) = object : A<String> {
override fun run() : String {
return call(y)
}
}
public inline fun <T> call(inlineOptions(InlineOption.ONLY_LOCAL_RETURN) f: () -> T): T = object : A<T> {
override fun run() : T {
return f()
}
}.run()