Support crossinline suspend lambda as parameter of inline function

Use fake continuation instead of ALOAD 0 while inlining
Do not generate state machine for inner lambdas and inner objects,
which capture crossinline suspend lambda.

 #KT-19159: Fixed
This commit is contained in:
Ilmir Usmanov
2018-01-18 15:21:19 +03:00
parent 042ca55be7
commit 6854135077
80 changed files with 5214 additions and 144 deletions
@@ -35,7 +35,11 @@ fun builderConsumer(c: suspend () -> Consumer): Consumer {
}
class Container {
var y: String = "FAIL 1"
var y: String = "FAIL 0"
val consumer0 = crossInlineBuilderConsumer { s ->
y = s
}
val consumer1 = crossInlineBuilderConsumer { s ->
builder {
@@ -108,6 +112,9 @@ class Container {
fun box(): String {
val c = Container()
c.consumer0.consume("OK")
if (c.y != "OK") return c.y
c.y = "FAIL 1"
c.consumer1.consume("OK")
if (c.y != "OK") return c.y
c.y = "FAIL 2"