Files
kotlin-fork/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/ReceiverNullability.fir.kt
T
Denis Zharkov f97cc0b62d FIR: Rework receivers processing in resolution
- Put extensionReceiver to candidate even if it's explicit (for sake of clarity)
- Split CheckReceiver (dispatch part should only check nullability)
2020-11-16 15:50:39 +03:00

45 lines
718 B
Kotlin
Vendored

class A {
fun foo() {}
}
fun A.bar() {}
fun A?.buzz() {}
fun test(a : A?) {
a.<!INAPPLICABLE_CANDIDATE!>foo<!>() // error
a.<!INAPPLICABLE_CANDIDATE!>bar<!>() // error
a.buzz()
a?.foo()
a?.bar()
a?.buzz()
}
fun A.test2() {
foo()
bar()
buzz()
this.foo()
this.bar()
this.buzz()
this?.foo() // warning
this?.bar() // warning
this?.buzz() // warning
}
fun A?.test3() {
<!INAPPLICABLE_CANDIDATE!>foo<!>() // error
<!INAPPLICABLE_CANDIDATE!>bar<!>() // error
buzz()
this.<!INAPPLICABLE_CANDIDATE!>foo<!>() // error
this.<!INAPPLICABLE_CANDIDATE!>bar<!>() // error
this.buzz()
this?.foo()
this?.bar()
this?.buzz()
}