Files
kotlin-fork/compiler/testData/diagnostics/tests/generics/nullability/smartCastsOnThis.fir.kt
T
2021-04-09 12:32:45 +03:00

37 lines
655 B
Kotlin
Vendored

// !WITH_NEW_INFERENCE
// !DIAGNOSTICS: -UNUSED_EXPRESSION,-UNUSED_VARIABLE
fun <T : CharSequence?> T.bar1() {}
fun CharSequence?.bar2() {}
fun <T : CharSequence> T.bar3() {}
fun CharSequence.bar4() {}
fun <T : String?> T.foo() {
if (this != null) {
if (this != null) {}
length
this<!UNNECESSARY_SAFE_CALL!>?.<!>length
bar1()
bar2()
bar3()
bar4()
this<!UNNECESSARY_SAFE_CALL!>?.<!>bar1()
}
<!INAPPLICABLE_CANDIDATE!>length<!>
if (this is String) {
length
this<!UNNECESSARY_SAFE_CALL!>?.<!>length
bar1()
bar2()
bar3()
}
}