Files
kotlin-fork/compiler/testData/diagnostics/tests/smartCasts/loops/whileWithAssertInConditionAndBreakAfter.kt
T
Dmitry Savvinov 939b58f8f4 Fix testdata to incorrect to keep local testruns green
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).
2018-11-06 19:29:28 +03:00

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
}