Files
kotlin-fork/compiler/testData/diagnostics/tests/smartCasts/kt45814.kt
T
Dmitriy Novozhilov d01a2c7271 [Test] Add test for KT-45814
^KT-45814 Can't reproduce
2023-01-31 07:53:10 +00:00

24 lines
665 B
Kotlin
Vendored

// SKIP_TXT
// ISSUE: KT-45814
class Foo(val bar: String?)
fun test_1(foo: Foo?) {
foo!!.bar.let {
foo<!UNNECESSARY_SAFE_CALL!>?.<!>bar?.length // Unnecessary
<!DEBUG_INFO_SMARTCAST!>foo<!>.bar?.length // Correct
foo<!UNNECESSARY_SAFE_CALL!>?.<!>bar?.length // Unnecessary
}
<!DEBUG_INFO_SMARTCAST!>foo<!>.bar?.length
foo<!UNNECESSARY_SAFE_CALL!>?.<!>bar?.length // Unnecessary
}
fun test_2(foo: Foo?) {
foo!!.bar.let {
<!DEBUG_INFO_SMARTCAST!>foo<!>.bar?.length // Correct
foo<!UNNECESSARY_SAFE_CALL!>?.<!>bar?.length // Unnecessary
Unit
}
<!DEBUG_INFO_SMARTCAST!>foo<!>.bar?.length
}