939b58f8f4
This test was originally written with fix for KT-22379 Lately, fix was proven to be wrong and reverted (KT-27084), which made this test fail. Correct solution here would be to mute test with link to YT issue, but unfortunately we don't have infrastructure to mute tests locally (yet), which is a major issue because this tests is a part of very popular for local smoke-testing test suite (DiagnosticTestsGenerated).
23 lines
616 B
Kotlin
Vendored
23 lines
616 B
Kotlin
Vendored
// !LANGUAGE: +SoundSmartcastFromLoopConditionForLoopAssignedVariables
|
|
|
|
fun foo() {
|
|
var x: String? = "123"
|
|
while (x!!.length < 42) {
|
|
x = null
|
|
break
|
|
|
|
}
|
|
// TODO: this testdata fixates undesired behavior (it should be an unsafe call)
|
|
<!DEBUG_INFO_SMARTCAST!>x<!>.length // 'x' is unsoundly smartcasted here
|
|
}
|
|
|
|
fun bar() {
|
|
var x: List<Int>? = ArrayList<Int>(1)
|
|
for (i in x!!) {
|
|
x = null
|
|
break
|
|
|
|
}
|
|
// TODO: this testdata fixates undesired behavior (it should be an unsafe call)
|
|
<!DEBUG_INFO_SMARTCAST!>x<!>.size // 'x' is unsoundly smartcasted here
|
|
} |