[FIR] Prefer the non-smartcasted receiver in resolution if it's visible

Previously, we would ignore the candidate with the non-smartcasted
receiver if they have the same symbol.
Now we prefer them when they're visible or when the smart cast changes
the nullability.
This commit is contained in:
Kirill Rakhman
2023-12-18 17:32:28 +01:00
committed by Space Team
parent 5186ba80e2
commit ad2689ecbf
15 changed files with 105 additions and 251 deletions
@@ -27,4 +27,21 @@ class Derived : Base() {
x.y = x.y + 1
}
}
protected fun baz2(x: Base?) {
x.<!INVISIBLE_REFERENCE!>foo<!>()
x.<!INVISIBLE_REFERENCE!>bar<!>()
x.<!INVISIBLE_REFERENCE!>x<!> = x.<!INVISIBLE_REFERENCE!>x<!> + 1
x.<!INVISIBLE_SETTER!>y<!> = x<!UNSAFE_CALL!>.<!>y + 1
if (x is Derived) {
x.foo()
x.bar()
x.baz(x)
x.x = x.x + 1
x.y = x.y + 1
}
}
}