Files
kotlin-fork/idea/testData/checker/infos/SmartCastsWithSafeAccess.kt
T
Ilya Kirillov 861c9b8e45 FIR IDE: unmute passing tests
fix unmute passing
2021-01-15 17:23:04 +01:00

38 lines
659 B
Kotlin
Vendored

// FIR_COMPARISON
interface A {
fun foo()
}
interface B : A {
fun bar()
}
interface C
interface D : A
fun test(a: A?) {
if (a != null && a is B?) {
<info descr="Smart cast to B">a</info>.bar()
}
if (a is B && a is C) {
<info descr="Smart cast to B">a</info>.foo()
}
if (a is B? && a is C?) {
<info descr="Smart cast to B?">a</info><info>?.</info>bar()
}
a<info>?.</info>foo()
if (a is B? && a is C?) {
a<info>?.</info>foo()
}
if (a is B && a is D) {
//when it's resolved, the message should be 'Smart cast to A'
<info>a</info>.<error>foo</error>
}
}