FIR: report UNSAFE_CALL on dot when possible

This commit is contained in:
Mikhail Glukhikh
2021-01-29 10:25:59 +03:00
parent 0ee4f1f393
commit 7d4eaefd36
249 changed files with 1208 additions and 1649 deletions
@@ -12,7 +12,7 @@ class Another1 {
fun Another1.main(x: Bar1<String>?) {
x?.value {}
x?.value.<!UNSAFE_CALL!>invoke<!>({})
x?.value<!UNSAFE_CALL!>.<!>invoke({})
}
// Test case 2: additional receiver, non-generic invoke
@@ -26,7 +26,7 @@ class Another2 {
fun Another2.main(x: Bar2<String>?) {
x?.value(1)
x?.value.<!UNSAFE_CALL!>invoke<!>(1)
x?.value<!UNSAFE_CALL!>.<!>invoke(1)
}
// Test case 3: additional generic receiver, generic invoke
@@ -40,7 +40,7 @@ class Another3<T> {
fun <K> Another3<K>.main(x: Bar3<K>?) {
x?.value(1)
x?.value.<!UNSAFE_CALL!>invoke<!>(1)
x?.value<!UNSAFE_CALL!>.<!>invoke(1)
}
// Test case 4: additional receiver, generic invoke with nullable receiver
@@ -68,7 +68,7 @@ class Another5 {
fun Another5.main(x: Bar5?) {
x?.value {}
x?.value.<!UNSAFE_CALL!>invoke<!>({})
x?.value<!UNSAFE_CALL!>.<!>invoke({})
}
// Test case 6: top-level generic invoke
@@ -96,7 +96,7 @@ operator fun <T> Foo7<T>.invoke(x: Int) {}
fun Another7.main(x: Bar7<String>?) {
x?.value(1)
x?.value.<!UNSAFE_CALL!>invoke<!>(1)
x?.value<!UNSAFE_CALL!>.<!>invoke(1)
}
// Test case 8: top-level non-generic invoke
@@ -136,5 +136,5 @@ class Another10 {
fun Another10.main(x: Bar10<String>?) {
x?.value {}
x?.value.<!UNSAFE_CALL!>invoke<!>({})
x?.value<!UNSAFE_CALL!>.<!>invoke({})
}
@@ -7,7 +7,7 @@ fun test(a: A) {
(a.x)("")
}
"".<!UNRESOLVED_REFERENCE!>(a.x)()<!>
a.<!UNSAFE_CALL!>x<!>("")
a<!UNSAFE_CALL!>.<!>x("")
<!UNSAFE_CALL!>(a.x)("")<!>
with("") {
@@ -30,7 +30,7 @@ fun testNullableReceiver(nullable: Cls?) {
}
fun testNotNullableReceiver(notNullable: Cls) {
notNullable.<!UNSAFE_CALL!>nullableExtensionProperty<!>()
notNullable<!UNSAFE_CALL!>.<!>nullableExtensionProperty()
notNullable?.extensionProperty()
}
@@ -38,6 +38,6 @@ fun testFlexibleReceiver() {
val flexible = JavaClass.createFlexible()
flexible.extensionProperty()
flexible?.extensionProperty()
flexible.<!UNSAFE_CALL!>nullableExtensionProperty<!>()
flexible<!UNSAFE_CALL!>.<!>nullableExtensionProperty()
flexible?.<!UNSAFE_CALL!>nullableExtensionProperty<!>()
}