-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Commit
inside 'create' if 'create' overrides 'create' from BaseContinuationImpl. In other words, unbox the parameter if 'create' accepts only one parameter. #KT-43249 Fixed #KT-43533 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,26 @@ | ||
// WITH_RUNTIME | ||
// KJS_WITH_FULL_RUNTIME | ||
|
||
import kotlin.coroutines.* | ||
|
||
fun builder(c: suspend () -> Unit) { | ||
c.startCoroutine(Continuation(EmptyCoroutineContext) { | ||
it.getOrThrow() | ||
}) | ||
} | ||
|
||
inline class IC(val s: String) | ||
|
||
suspend fun <T> List<T>.onEach(c: suspend (T) -> Unit) { | ||
for (e in this) { | ||
c(e) | ||
} | ||
} | ||
|
||
fun box(): String { | ||
var res = "" | ||
builder { | ||
listOf(IC("O"), IC("K")).onEach { res += it.s } | ||
} | ||
return res | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// WITH_RUNTIME | ||
// KJS_WITH_FULL_RUNTIME | ||
|
||
import kotlin.coroutines.* | ||
|
||
fun builder(c: suspend () -> Unit) { | ||
c.startCoroutine(Continuation(EmptyCoroutineContext) { | ||
it.getOrThrow() | ||
}) | ||
} | ||
|
||
inline class IC(val s: String) | ||
|
||
suspend fun <T> List<T>.onEach(c: suspend (T) -> Unit) { | ||
for (e in this) { | ||
c(e) | ||
} | ||
} | ||
|
||
var c: Continuation<Any>? = null | ||
|
||
fun box(): String { | ||
var res = "" | ||
builder { | ||
listOf(IC("O"), IC("K")).onEach { res += suspendCoroutine<String> { cont -> | ||
@Suppress("UNCHECKED_CAST") | ||
c = cont as Continuation<Any> | ||
}} | ||
} | ||
c?.resume("O") | ||
c?.resume("K") | ||
return res | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// WITH_RUNTIME | ||
// WITH_COROUTINES | ||
// KJS_WITH_FULL_RUNTIME | ||
|
||
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) | ||
|
||
suspend fun <T> List<T>.onEach(c: suspend (T) -> Unit) { | ||
for (e in this) { | ||
c(e) | ||
} | ||
} | ||
|
||
var c: Continuation<Any>? = null | ||
|
||
fun box(): String { | ||
builder { | ||
listOf(IC("O"), IC("K")).onEach { suspendCoroutine<String> { cont -> | ||
@Suppress("UNCHECKED_CAST") | ||
c = cont as Continuation<Any> | ||
}} | ||
} | ||
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.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.