Files
kotlin-fork/compiler/fir/analysis-tests/testData/resolve/smartcasts/equalsAndIdentity.kt
T
2020-03-19 09:51:01 +03:00

38 lines
612 B
Kotlin
Vendored

// !DUMP_CFG
interface A {
fun foo()
}
fun test_1(x: A, y: A?) {
if (x == y) {
x.foo()
y.foo()
}
if (x === y) {
x.foo()
y.foo()
}
}
fun test_2(x: A?, y: A?) {
if (x == y) {
x.<!INAPPLICABLE_CANDIDATE!>foo<!>()
y.<!INAPPLICABLE_CANDIDATE!>foo<!>()
}
if (x === y) {
x.<!INAPPLICABLE_CANDIDATE!>foo<!>()
y.<!INAPPLICABLE_CANDIDATE!>foo<!>()
}
}
fun test_3(x: A?, y: A?) {
if (y == null) return
if (x == y) {
x.foo()
y.foo()
}
if (x === y) {
x.foo()
y.foo()
}
}