[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
@@ -4,7 +4,7 @@ FILE: orInWhenBranch.kt
public final fun test_1(a: R|kotlin/Any?|): R|kotlin/Unit| {
when (R|<local>/a|) {
($subj$ is R|kotlin/String|) || ($subj$ is R|kotlin/Any|) -> {
R|<local>/a|.<Inapplicable(INAPPLICABLE_WRONG_RECEIVER): /foo>#()
R|<local>/a|.<None of the following candidates is applicable because of receiver type mismatch: [/foo]>#()
}
}
@@ -12,7 +12,7 @@ FILE: orInWhenBranch.kt
public final fun test_2(a: R|kotlin/Any?|): R|kotlin/Unit| {
when () {
(R|<local>/a| is R|kotlin/String|) || (R|<local>/a| is R|kotlin/Any|) -> {
R|<local>/a|.<Inapplicable(INAPPLICABLE_WRONG_RECEIVER): /foo>#()
R|<local>/a|.<None of the following candidates is applicable because of receiver type mismatch: [/foo]>#()
}
}
@@ -20,7 +20,7 @@ FILE: orInWhenBranch.kt
public final fun test_3(a: R|kotlin/Any?|, b: R|kotlin/Boolean|): R|kotlin/Unit| {
when (R|<local>/a|) {
($subj$ is R|kotlin/String|) || ==($subj$, R|<local>/b|) -> {
R|<local>/a|.<Inapplicable(INAPPLICABLE_WRONG_RECEIVER): /foo>#()
R|<local>/a|.<None of the following candidates is applicable because of receiver type mismatch: [/foo]>#()
}
}
@@ -28,7 +28,7 @@ FILE: orInWhenBranch.kt
public final fun test_4(a: R|kotlin/Any?|, b: R|kotlin/Boolean|): R|kotlin/Unit| {
when () {
(R|<local>/a| is R|kotlin/String|) || R|<local>/b| -> {
R|<local>/a|.<Inapplicable(INAPPLICABLE_WRONG_RECEIVER): /foo>#()
R|<local>/a|.<None of the following candidates is applicable because of receiver type mismatch: [/foo]>#()
}
}
@@ -4,24 +4,24 @@ fun String.foo() {}
fun test_1(a: Any?) {
when (a) {
is String, is Any -> a.<!INAPPLICABLE_CANDIDATE!>foo<!>() // Should be Bad
is String, is Any -> a.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>foo<!>() // Should be Bad
}
}
fun test_2(a: Any?) {
if (a is String || a is Any) {
a.<!INAPPLICABLE_CANDIDATE!>foo<!>() // Should be Bad
a.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>foo<!>() // Should be Bad
}
}
fun test_3(a: Any?, b: Boolean) {
when (a) {
is String, b -> a.<!INAPPLICABLE_CANDIDATE!>foo<!>() // Should be Bad
is String, b -> a.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>foo<!>() // Should be Bad
}
}
fun test_4(a: Any?, b: Boolean) {
if (a is String || b) {
a.<!INAPPLICABLE_CANDIDATE!>foo<!>() // Should be Bad
a.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>foo<!>() // Should be Bad
}
}