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:
Jinseong Jeon
2021-01-26 16:03:27 -08:00
committed by Mikhail Glukhikh
parent 4b823eca21
commit e72ddbcbfe
275 changed files with 1426 additions and 1388 deletions
@@ -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<!>
}
}