FIR checker: differentiate UNSAFE_CALL from INAPPLICABLE_CANDIDATE
To do so, inside the root cause of inapplicable candidate errors, we will record expected/actual type of receiver, if any. That will help identifying inapplicable calls on nullable receiver.
This commit is contained in:
committed by
Mikhail Glukhikh
parent
4b823eca21
commit
e72ddbcbfe
@@ -14,14 +14,14 @@ fun test1(x: ClassLevel1?) {
|
||||
fun case_2(x: Any?) {
|
||||
(x as ClassLevel1?)!!
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("ClassLevel1? & kotlin.Any?")!>x<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("ClassLevel1? & kotlin.Any?")!>x<!>.<!INAPPLICABLE_CANDIDATE!>test1<!>()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("ClassLevel1? & kotlin.Any?")!>x<!>.<!UNSAFE_CALL!>test1<!>()
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 3
|
||||
fun case_3(x: Any?) {
|
||||
if (x as ClassLevel1? is ClassLevel1) {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("ClassLevel1? & kotlin.Any?")!>x<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("ClassLevel1? & kotlin.Any?")!>x<!>.<!INAPPLICABLE_CANDIDATE!>test1<!>()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("ClassLevel1? & kotlin.Any?")!>x<!>.<!UNSAFE_CALL!>test1<!>()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ fun case_3(x: Any?) {
|
||||
fun case_4(x: Any?) {
|
||||
if ((x as Class).prop_8 != null) {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Class & kotlin.Any?")!>x<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Class & kotlin.Any?")!>x<!>.prop_8.<!INAPPLICABLE_CANDIDATE!>prop_8<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Class & kotlin.Any?")!>x<!>.prop_8.<!UNSAFE_CALL!>prop_8<!>
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +37,6 @@ fun case_4(x: Any?) {
|
||||
fun case_5(x: Class) {
|
||||
if (x!!.prop_8 != null) {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Class & Class")!>x<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Class & Class")!>x<!>.prop_8.<!INAPPLICABLE_CANDIDATE!>prop_8<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("Class & Class")!>x<!>.prop_8.<!UNSAFE_CALL!>prop_8<!>
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user