[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:
committed by
Space Team
parent
5186ba80e2
commit
ad2689ecbf
+4
-8
@@ -29,12 +29,10 @@ FILE fqName:<root> fileName:/propertyInitializationAfterSmartCast.kt
|
||||
TYPE_OP type=<root>.Derived_1 origin=CAST typeOperand=<root>.Derived_1
|
||||
GET_VAR '<this>: <root>.Base_1 declared in <root>.Base_1' type=<root>.Base_1 origin=null
|
||||
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Any? visibility:private [final]' type=kotlin.Unit origin=null
|
||||
receiver: TYPE_OP type=<root>.Derived_1 origin=IMPLICIT_CAST typeOperand=<root>.Derived_1
|
||||
GET_VAR '<this>: <root>.Base_1 declared in <root>.Base_1' type=<root>.Base_1 origin=null
|
||||
receiver: GET_VAR '<this>: <root>.Base_1 declared in <root>.Base_1' type=<root>.Base_1 origin=null
|
||||
value: CONST String type=kotlin.String value="O"
|
||||
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.Any? visibility:private [final]' type=kotlin.Unit origin=null
|
||||
receiver: TYPE_OP type=<root>.Derived_1 origin=IMPLICIT_CAST typeOperand=<root>.Derived_1
|
||||
GET_VAR '<this>: <root>.Base_1 declared in <root>.Base_1' type=<root>.Base_1 origin=null
|
||||
receiver: GET_VAR '<this>: <root>.Base_1 declared in <root>.Base_1' type=<root>.Base_1 origin=null
|
||||
value: CONST String type=kotlin.String value="O"
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||
overridden:
|
||||
@@ -114,12 +112,10 @@ FILE fqName:<root> fileName:/propertyInitializationAfterSmartCast.kt
|
||||
TYPE_OP type=<root>.Impl_2 origin=CAST typeOperand=<root>.Impl_2
|
||||
GET_VAR '<this>: <root>.Base_2 declared in <root>.Base_2' type=<root>.Base_2 origin=null
|
||||
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:x type:kotlin.Any? visibility:private [final]' type=kotlin.Unit origin=null
|
||||
receiver: TYPE_OP type=<root>.Impl_2 origin=IMPLICIT_CAST typeOperand=<root>.Impl_2
|
||||
GET_VAR '<this>: <root>.Base_2 declared in <root>.Base_2' type=<root>.Base_2 origin=null
|
||||
receiver: GET_VAR '<this>: <root>.Base_2 declared in <root>.Base_2' type=<root>.Base_2 origin=null
|
||||
value: CONST String type=kotlin.String value="K"
|
||||
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:y type:kotlin.Any? visibility:private [final]' type=kotlin.Unit origin=null
|
||||
receiver: TYPE_OP type=<root>.Impl_2 origin=IMPLICIT_CAST typeOperand=<root>.Impl_2
|
||||
GET_VAR '<this>: <root>.Base_2 declared in <root>.Base_2' type=<root>.Base_2 origin=null
|
||||
receiver: GET_VAR '<this>: <root>.Base_2 declared in <root>.Base_2' type=<root>.Base_2 origin=null
|
||||
value: CONST String type=kotlin.String value="K"
|
||||
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
|
||||
overridden:
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
// IGNORE_BACKEND_K2: JVM_IR
|
||||
|
||||
open class SuperFoo {
|
||||
public fun bar() {
|
||||
if (this is Foo) {
|
||||
|
||||
Reference in New Issue
Block a user