Files
kotlin-fork/compiler/testData/diagnostics/tests/smartCasts/alwaysNull.fir.kt
T
Mark Punzalan d1531f9cdd FIR: Choose a resolved candidate for augmented assignment when both
assign and operator candidates are unsuccessful.
2021-06-03 20:18:04 +03:00

23 lines
450 B
Kotlin
Vendored

fun foo(): String {
var s: String?
s = null
s?.length
s<!UNSAFE_CALL!>.<!>length
if (s == null) return s!!
var t: String? = "y"
if (t == null) t = "x"
var x: Int? = null
if (x == null) x <!UNSAFE_OPERATOR_CALL!>+=<!> null
return t + s
}
fun String?.gav() {}
fun bar(s: String?) {
if (s != null) return
s.gav()
s <!USELESS_CAST!>as? String<!>
s <!USELESS_CAST!>as String?<!>
s as String
}