[FIR] Implement UNRESOLVED_REFERENCE_WRONG_RECEIVER

This commit is contained in:
Ivan Kochurkin
2021-08-10 16:40:51 +03:00
committed by Space
parent 34cc7e5199
commit 84c5f58cab
129 changed files with 322 additions and 481 deletions
@@ -16,37 +16,37 @@ interface C {
fun foo(x: Any?) {
if (x is A && x is B) {
x.foo().checkType { <!INAPPLICABLE_CANDIDATE!>_<!><String>() }
x.foo().checkType { <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>_<!><String>() }
x.foo().checkType { _<String?>() }
}
if (x is B && x is A) {
x.foo().checkType { <!INAPPLICABLE_CANDIDATE!>_<!><String>() }
x.foo().checkType { <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>_<!><String>() }
x.foo().checkType { _<String?>() }
}
if (x is A && x is C) {
x.foo().checkType { _<String>() }
x.foo().checkType { <!INAPPLICABLE_CANDIDATE!>_<!><String?>() }
x.foo().checkType { <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>_<!><String?>() }
}
if (x is C && x is A) {
x.foo().checkType { _<String>() }
x.foo().checkType { <!INAPPLICABLE_CANDIDATE!>_<!><String?>() }
x.foo().checkType { <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>_<!><String?>() }
}
if (x is A && x is B && x is C) {
x.foo().checkType { _<String>() }
x.foo().checkType { <!INAPPLICABLE_CANDIDATE!>_<!><String?>() }
x.foo().checkType { <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>_<!><String?>() }
}
if (x is B && x is A && x is C) {
x.foo().checkType { _<String>() }
x.foo().checkType { <!INAPPLICABLE_CANDIDATE!>_<!><String?>() }
x.foo().checkType { <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>_<!><String?>() }
}
if (x is B && x is C && x is A) {
x.foo().checkType { _<String>() }
x.foo().checkType { <!INAPPLICABLE_CANDIDATE!>_<!><String?>() }
x.foo().checkType { <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>_<!><String?>() }
}
}
@@ -7,7 +7,7 @@ fun case_0() {
this as Int
this // error in NI: required Int, found Any?; just inferred to Any? in OI
}
y checkType { <!INAPPLICABLE_CANDIDATE!>_<!><Any?>() }
y checkType { <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>_<!><Any?>() }
y checkType { _<Int>() }
}
@@ -19,7 +19,7 @@ fun case_1(z: Any?) {
else -> return@run ""
}
}
y checkType { <!INAPPLICABLE_CANDIDATE!>_<!><Any?>() }
y checkType { <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>_<!><Any?>() }
y checkType { _<kotlin.String>() }
// y is inferred to Any?
}
@@ -44,7 +44,7 @@ fun case_3(z: Any?) {
else -> return@let ""
}
}
y checkType { <!INAPPLICABLE_CANDIDATE!>_<!><Any?>() }
y checkType { <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>_<!><Any?>() }
y checkType { _<kotlin.String>() }
// y is inferred to String
}