Files
kotlin-fork/compiler/testData/diagnostics/tests/dataFlowInfoTraversal/DoWhileCondition.fir.kt
T
simon.ogorodnik 34e6649d31 [FIR] Harden check of argument type properly
Before this commit, nullable argument could match not null parameter.
Now we require also correct nullability that breaks some cases
2020-02-03 16:45:18 +03:00

21 lines
382 B
Kotlin
Vendored

// !CHECK_TYPE
fun simpleDoWhile(x: Int?, y0: Int) {
var y = y0
do {
checkSubtype<Int?>(x)
y++
} while (x!! == y)
checkSubtype<Int>(x)
}
fun doWhileWithBreak(x: Int?, y0: Int) {
var y = y0
do {
checkSubtype<Int?>(x)
y++
if (y > 0) break
} while (x!! == y)
<!INAPPLICABLE_CANDIDATE!>checkSubtype<!><Int>(x)
}