c6b32200df
List of issues: KT-28806, KT-7186, KT-22997, KT-1982, KT-22996, KT-54443, KT-37308, KT-37115, KT-4113, KT-25747, KT-24779
35 lines
815 B
Kotlin
Vendored
35 lines
815 B
Kotlin
Vendored
// ISSUE: KT-25747
|
|
fun test1() {
|
|
val nullableString: String? = ""
|
|
val savedSmartCastResult = nullableString != null
|
|
if (savedSmartCastResult) {
|
|
nullableString<!UNSAFE_CALL!>.<!>length
|
|
}
|
|
}
|
|
|
|
fun test2() {
|
|
var nullableAny: Any? = ""
|
|
val savedSmartCastResult = nullableAny is String
|
|
nullableAny = 10
|
|
if (savedSmartCastResult) {
|
|
nullableAny.<!UNRESOLVED_REFERENCE!>length<!>
|
|
}
|
|
}
|
|
|
|
class A {
|
|
val a: String? = ""
|
|
}
|
|
fun test3(a: A){
|
|
val savedSmartCastResult = a.a != null
|
|
if(savedSmartCastResult) {
|
|
a.a<!UNSAFE_CALL!>.<!>length
|
|
}
|
|
}
|
|
|
|
fun test4() {
|
|
val nullableAny: Any? = ""
|
|
val savedSmartCastResult = (nullableAny!= null && nullableAny is String?)
|
|
if(savedSmartCastResult) {
|
|
nullableAny.<!UNRESOLVED_REFERENCE!>length<!>
|
|
}
|
|
} |