Files
2021-04-09 12:32:45 +03:00

15 lines
369 B
Kotlin
Vendored

// See KT-7290
class MyClass(val x: String?)
fun foo(y: MyClass?): Int {
// x here is smartcast but y is not
val z = y?.x?.subSequence(0, y.x.length)
// !! is necessary here
y!!.x
return z?.length ?: -1
}
fun bar(y: MyClass?) {
y?.x!!.length
// !! is NOT necessary here, because y?.x != null
y<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>.x
}