-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Commit
1. merge(null of type A, null of type B) = null of unknown type; 2. merge(null of type A, something of type B) = merge(unknown null, B). ^KT-52311 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,29 @@ | ||
// WITH_STDLIB | ||
// WITH_COROUTINES | ||
import helpers.* | ||
import kotlin.coroutines.* | ||
import kotlin.coroutines.intrinsics.* | ||
|
||
fun someCondition() = true | ||
|
||
suspend fun suspendHere() = suspendCoroutineUninterceptedOrReturn { | ||
it.resume(Unit) | ||
COROUTINE_SUSPENDED | ||
} | ||
|
||
fun expectString(x: String?) = x!! | ||
|
||
suspend fun foo(): String { | ||
var x: String? = null | ||
if (someCondition()) { | ||
x = "OK" | ||
} | ||
suspendHere() | ||
return expectString(x) | ||
} | ||
|
||
fun box(): String { | ||
var result = "fail" | ||
suspend { result = foo() }.startCoroutine(EmptyContinuation) | ||
return result | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// WITH_STDLIB | ||
// WITH_COROUTINES | ||
import helpers.* | ||
import kotlin.coroutines.* | ||
import kotlin.coroutines.intrinsics.* | ||
|
||
fun someCondition() = false | ||
|
||
suspend fun suspendHere() = suspendCoroutineUninterceptedOrReturn { | ||
it.resume(Unit) | ||
COROUTINE_SUSPENDED | ||
} | ||
|
||
fun expectString(x: String?) = x!! | ||
|
||
suspend fun foo(): String { | ||
var x: String? = "OK" | ||
if (someCondition()) { | ||
x = null as String? | ||
} | ||
suspendHere() | ||
return expectString(x) | ||
} | ||
|
||
fun box(): String { | ||
var result = "fail" | ||
suspend { result = foo() }.startCoroutine(EmptyContinuation) | ||
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.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.