FIR resolve: add receiver consistency checking
NB: looks like checker itself may be not needed, but it's important to check extension receiver presence during candidate collection
This commit is contained in:
@@ -15,5 +15,5 @@ FILE: localImplicitBodies.kt
|
||||
|
||||
}
|
||||
|
||||
lval g: <ERROR TYPE REF: Unresolved name: abc> = R|<local>/x|.R|/sss|()
|
||||
lval g: <ERROR TYPE REF: Unresolved name: sss> = R|<local>/x|.<Unresolved name: sss>#()
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
fun foo() {}
|
||||
|
||||
class C {
|
||||
fun bar() {}
|
||||
fun err() {}
|
||||
|
||||
class Nested {
|
||||
fun test() {
|
||||
err()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun test() {
|
||||
val c = C()
|
||||
foo()
|
||||
c.bar()
|
||||
|
||||
val err = C()
|
||||
err.foo()
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
FILE: receiverConsistency.kt
|
||||
public final fun foo(): R|kotlin/Unit| {
|
||||
}
|
||||
public final class C : R|kotlin/Any| {
|
||||
public constructor(): R|C| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final fun bar(): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
public final fun err(): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
public final class Nested : R|kotlin/Any| {
|
||||
public constructor(): R|C.Nested| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
R|/C.err|()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
lval c: R|C| = R|/C.C|()
|
||||
R|/foo|()
|
||||
R|<local>/c|.R|/C.bar|()
|
||||
lval err: R|C| = R|/C.C|()
|
||||
R|<local>/err|.<Unresolved name: foo>#()
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
class Owner {
|
||||
|
||||
fun foo() {
|
||||
bar()
|
||||
this.bar()
|
||||
}
|
||||
|
||||
fun bar() {
|
||||
val i = Inner()
|
||||
i.baz()
|
||||
}
|
||||
|
||||
fun err() {}
|
||||
|
||||
inner class Inner {
|
||||
fun baz() {
|
||||
gau()
|
||||
this.gau()
|
||||
}
|
||||
|
||||
fun gau() {
|
||||
val o = Owner()
|
||||
o.foo()
|
||||
foo()
|
||||
this@Owner.foo()
|
||||
this.err()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun test() {
|
||||
val o = Owner()
|
||||
o.foo()
|
||||
val err = Owner.Inner()
|
||||
err.baz()
|
||||
val i = o.Inner()
|
||||
i.gau()
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
FILE: inner.kt
|
||||
public final class Owner : R|kotlin/Any| {
|
||||
public constructor(): R|Owner| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final fun foo(): R|kotlin/Unit| {
|
||||
R|/Owner.bar|()
|
||||
this#.R|/Owner.bar|()
|
||||
}
|
||||
|
||||
public final fun bar(): R|kotlin/Unit| {
|
||||
lval i: R|Owner.Inner| = R|/Owner.Inner.Inner|()
|
||||
R|<local>/i|.R|/Owner.Inner.baz|()
|
||||
}
|
||||
|
||||
public final fun err(): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
public final inner class Inner : R|kotlin/Any| {
|
||||
public constructor(): R|Owner.Inner| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final fun baz(): R|kotlin/Unit| {
|
||||
R|/Owner.Inner.gau|()
|
||||
this#.R|/Owner.Inner.gau|()
|
||||
}
|
||||
|
||||
public final fun gau(): R|kotlin/Unit| {
|
||||
lval o: R|Owner| = R|/Owner.Owner|()
|
||||
R|<local>/o|.R|/Owner.foo|()
|
||||
R|/Owner.foo|()
|
||||
this@Owner.R|/Owner.foo|()
|
||||
this#.<Unresolved name: err>#()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
public final fun test(): R|kotlin/Unit| {
|
||||
lval o: R|Owner| = R|/Owner.Owner|()
|
||||
R|<local>/o|.R|/Owner.foo|()
|
||||
lval err: R|Owner.Inner| = R|/Owner|.R|/Owner.Inner.Inner|()
|
||||
R|<local>/err|.R|/Owner.Inner.baz|()
|
||||
lval i: R|Owner.Inner| = R|<local>/o|.R|/Owner.Inner.Inner|()
|
||||
R|<local>/i|.R|/Owner.Inner.gau|()
|
||||
}
|
||||
@@ -20,6 +20,11 @@ class Owner {
|
||||
val o = Owner()
|
||||
o.foo()
|
||||
}
|
||||
|
||||
fun err() {
|
||||
foo()
|
||||
this.foo()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,11 @@ FILE: simple.kt
|
||||
R|<local>/o|.R|/Owner.foo|()
|
||||
}
|
||||
|
||||
public final fun err(): R|kotlin/Unit| {
|
||||
R|/Owner.foo|()
|
||||
this#.<Unresolved name: foo>#()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user