FIR checker: warn unnecessary safe calls

This commit is contained in:
Jinseong Jeon
2021-04-01 11:55:05 -07:00
committed by Mikhail Glukhikh
parent 2ecb6733ed
commit 5a0b75bd89
65 changed files with 232 additions and 349 deletions
@@ -1,44 +0,0 @@
class A {
fun foo() {}
}
fun A.bar() {}
fun A?.buzz() {}
fun test(a : A?) {
a<!UNSAFE_CALL!>.<!>foo() // error
a<!UNSAFE_CALL!>.<!>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() {
<!UNSAFE_CALL!>foo<!>() // error
<!UNSAFE_CALL!>bar<!>() // error
buzz()
this<!UNSAFE_CALL!>.<!>foo() // error
this<!UNSAFE_CALL!>.<!>bar() // error
this.buzz()
this?.foo()
this?.bar()
this?.buzz()
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
class A {
fun foo() {}
}