-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Commit
inside 'invoke' if 'create' does not override 'create' from BaseContinuationImpl. In other words, when suspend lambda accepts more than one parameter (including receiver). Do that only if we do not generate bridge 'invoke' method, since inline classes are unboxed in the bridge. Use mangled name for 'create' function in this case inside 'invoke'. #KT-43249 In progress #KT-39847 Fixed #KT-38937 Fixed
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// WITH_RUNTIME | ||
|
||
import kotlin.coroutines.* | ||
|
||
fun builder(c: suspend () -> Unit) { | ||
c.startCoroutine(Continuation(EmptyCoroutineContext) { | ||
it.getOrThrow() | ||
}) | ||
} | ||
|
||
inline class IC(val s: String) | ||
|
||
fun box(): String { | ||
var res = "FAIL" | ||
val lambda: suspend (IC, IC) -> String = { a, b -> | ||
a.s + b.s | ||
} | ||
builder { | ||
res = lambda(IC("O"), IC("K")) | ||
} | ||
return res | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// WITH_RUNTIME | ||
|
||
import kotlin.coroutines.* | ||
|
||
fun builder(c: suspend () -> Unit) { | ||
c.startCoroutine(Continuation(EmptyCoroutineContext) { | ||
it.getOrThrow() | ||
}) | ||
} | ||
|
||
inline class IC(val s: String) | ||
|
||
var c: Continuation<Any>? = null | ||
|
||
var res = "FAIL" | ||
|
||
fun box(): String { | ||
val lambda: suspend (IC, IC) -> String = { _, _ -> | ||
suspendCoroutine<String> { | ||
@Suppress("UNCHECKED_CAST") | ||
c = it as Continuation<Any> | ||
} | ||
} | ||
builder { | ||
res = lambda(IC("_"), IC("_")) | ||
} | ||
c?.resume("OK") | ||
return res | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// WITH_RUNTIME | ||
// WITH_COROUTINES | ||
|
||
import kotlin.coroutines.* | ||
import helpers.* | ||
|
||
var result = "FAIL" | ||
|
||
fun builder(c: suspend () -> Unit) { | ||
c.startCoroutine(handleExceptionContinuation { | ||
result = it.message!! | ||
}) | ||
} | ||
|
||
inline class IC(val s: String) | ||
|
||
var c: Continuation<Any>? = null | ||
|
||
fun box(): String { | ||
val lambda: suspend (IC, IC) -> String = { _, _ -> | ||
suspendCoroutine<String> { | ||
@Suppress("UNCHECKED_CAST") | ||
c = it as Continuation<Any> | ||
} | ||
} | ||
builder { | ||
lambda(IC("O"), IC("K")) | ||
} | ||
c?.resumeWithException(IllegalStateException("OK")) | ||
return result | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.