Safely check for suspend function parent
The issue here is that the function can be in unlowered file, and thus its parent package fragment and not class. #KT-49317 Fixed
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
// WITH_STDLIB
|
||||
|
||||
// FILE: 2.kt
|
||||
package other
|
||||
import builders.*
|
||||
import kotlin.coroutines.*
|
||||
|
||||
fun test() {
|
||||
suspend {
|
||||
foo { }
|
||||
}.startCoroutine(Continuation(EmptyCoroutineContext) {
|
||||
it.getOrThrow()
|
||||
})
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
test()
|
||||
return "OK"
|
||||
}
|
||||
|
||||
// FILE: 1.kt
|
||||
package builders
|
||||
|
||||
suspend fun foo(
|
||||
a: suspend () -> Unit = {}
|
||||
) {}
|
||||
Reference in New Issue
Block a user