Files
kotlin-fork/compiler/testData/diagnostics/tests/smartCasts/loops/elvisIfBreakInsideWhileTrue.kt
T
Ilya Chernikov bb996c1b27 Switch kotlin version to 1.8
with appropriate fixes in testdata, tests and other
places.
2022-06-29 10:20:30 +02:00

11 lines
304 B
Kotlin
Vendored

// FIR_IDENTICAL
public fun foo(x: String?, y: String?): Int {
while (true) {
x ?: <!INVALID_IF_AS_EXPRESSION!>if<!> (y == null) break
// y is nullable if x != null
y<!UNSAFE_CALL!>.<!>length
}
// y is null because of the break
return y<!UNSAFE_CALL!>.<!>length
}