5f0c9490bb
E.g.:
when (val y = x?.foo()) {
null -> ...
else -> ... // 'x' is also non-null here
}
9 lines
282 B
Kotlin
Vendored
9 lines
282 B
Kotlin
Vendored
// !LANGUAGE: +VariableDeclarationInWhenSubject
|
|
|
|
fun foo(s1: String, s2: String) = s1 + s2
|
|
|
|
fun test(x: Any?) =
|
|
when (val y = x?.toString()) {
|
|
null -> "null"
|
|
else -> foo(<!DEBUG_INFO_SMARTCAST!>x<!>.toString(), <!DEBUG_INFO_SMARTCAST!>y<!>)
|
|
} |