FIR: add UnsafeCall resolution diagnostics

Previously unsafe call is reported as part of InapplicableWrongReceiver.
This makes it difficult for the downstream checkers to report different
diagnostics.
This commit is contained in:
Tianyu Geng
2021-04-08 21:17:01 +03:00
committed by Mikhail Glukhikh
parent 43a2ad0467
commit 6a03f31e50
62 changed files with 283 additions and 283 deletions
@@ -13,7 +13,7 @@ fun <F : String?> bar(x: F) {
foo1(<!ARGUMENT_TYPE_MISMATCH!>x<!>)
foo1<F>(<!ARGUMENT_TYPE_MISMATCH!>x<!>)
x.<!INAPPLICABLE_CANDIDATE!>foo2<!>()
x<!UNSAFE_CALL!>.<!>foo2()
x.<!INAPPLICABLE_CANDIDATE!>foo2<!><F>()
}
@@ -1,6 +1,6 @@
fun <E : String?, T : ((CharSequence) -> Unit)?> foo(x: E, y: T) {
if (x != null) {
<!INAPPLICABLE_CANDIDATE!>y<!>(x)
<!UNSAFE_IMPLICIT_INVOKE_CALL!>y<!>(x)
}
if (y != null) {
@@ -1,6 +1,6 @@
fun <T : Any?> foo(x: T) {
if (x is String?) {
x.<!INAPPLICABLE_CANDIDATE!>length<!>
x<!UNSAFE_CALL!>.<!>length
if (x != null) {
x.length
@@ -24,7 +24,7 @@ fun <T : CharSequence?> foo(x: T) {
x<!UNNECESSARY_SAFE_CALL!>?.<!>bar1()
}
x.<!INAPPLICABLE_CANDIDATE!>length<!>
x<!UNSAFE_CALL!>.<!>length
if (x is String) {
x.length
@@ -23,7 +23,7 @@ fun <T : String?> T.foo() {
this<!UNNECESSARY_SAFE_CALL!>?.<!>bar1()
}
<!INAPPLICABLE_CANDIDATE!>length<!>
<!UNSAFE_CALL!>length<!>
if (this is String) {
length
@@ -8,7 +8,7 @@ class A<T : CharSequence?, E1 : T, E2: T?> {
x.bar()
if (1 == 1) {
y.<!INAPPLICABLE_CANDIDATE!>bar<!>()
y<!UNSAFE_CALL!>.<!>bar()
}
x?.bar()
@@ -7,7 +7,7 @@ fun CharSequence?.bar2() {}
fun <T : CharSequence> T.bar3() {}
fun <T : String?> foo(x: T) {
x.<!INAPPLICABLE_CANDIDATE!>length<!>
x<!UNSAFE_CALL!>.<!>length
x?.length
if (1 == 1) {
@@ -21,7 +21,7 @@ fun <T : String?> foo(x: T) {
x?.bar1()
x?.bar2()
x.<!INAPPLICABLE_CANDIDATE!>bar3<!>()
x<!UNSAFE_CALL!>.<!>bar3()
x?.let { it.length }
}