[FIR] Correctly detect super type in delegated constructor call

This commit is contained in:
Dmitriy Novozhilov
2020-04-16 17:46:18 +03:00
parent adfd478361
commit 7f02d57d88
56 changed files with 199 additions and 230 deletions
@@ -88,7 +88,14 @@ FILE fqName:<root> fileName:/argumentReorderingInDelegatingConstructorCall.kt
VALUE_PARAMETER name:xx index:0 type:kotlin.Int
VALUE_PARAMETER name:yy index:1 type:kotlin.Int
BLOCK_BODY
ERROR_CALL 'Cannot find delegated constructor call' type=kotlin.Any
BLOCK type=<root>.Base origin=ARGUMENTS_REORDERING_FOR_CALL
VAR IR_TEMPORARY_VARIABLE name:tmp_2 type:kotlin.Int [val]
GET_VAR 'yy: kotlin.Int declared in <root>.Test2.<init>' type=kotlin.Int origin=null
VAR IR_TEMPORARY_VARIABLE name:tmp_3 type:kotlin.Int [val]
GET_VAR 'xx: kotlin.Int declared in <root>.Test2.<init>' type=kotlin.Int origin=null
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> (x: kotlin.Int, y: kotlin.Int) [primary] declared in <root>.Base'
x: GET_VAR 'val tmp_3: kotlin.Int [val] declared in <root>.Test2.<init>' type=kotlin.Int origin=null
y: GET_VAR 'val tmp_2: kotlin.Int [val] declared in <root>.Test2.<init>' type=kotlin.Int origin=null
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Test2 modality:FINAL visibility:public superTypes:[<root>.Base]'
CONSTRUCTOR visibility:public <> (xxx:kotlin.Int, yyy:kotlin.Int, a:kotlin.Any) returnType:<root>.Test2
VALUE_PARAMETER name:xxx index:0 type:kotlin.Int
@@ -96,13 +103,13 @@ FILE fqName:<root> fileName:/argumentReorderingInDelegatingConstructorCall.kt
VALUE_PARAMETER name:a index:2 type:kotlin.Any
BLOCK_BODY
BLOCK type=<root>.Test2 origin=ARGUMENTS_REORDERING_FOR_CALL
VAR IR_TEMPORARY_VARIABLE name:tmp_2 type:kotlin.Int [val]
VAR IR_TEMPORARY_VARIABLE name:tmp_4 type:kotlin.Int [val]
GET_VAR 'yyy: kotlin.Int declared in <root>.Test2.<init>' type=kotlin.Int origin=null
VAR IR_TEMPORARY_VARIABLE name:tmp_3 type:kotlin.Int [val]
VAR IR_TEMPORARY_VARIABLE name:tmp_5 type:kotlin.Int [val]
GET_VAR 'xxx: kotlin.Int declared in <root>.Test2.<init>' type=kotlin.Int origin=null
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> (xx: kotlin.Int, yy: kotlin.Int) declared in <root>.Test2'
xx: GET_VAR 'val tmp_3: kotlin.Int [val] declared in <root>.Test2.<init>' type=kotlin.Int origin=null
yy: GET_VAR 'val tmp_2: kotlin.Int [val] declared in <root>.Test2.<init>' type=kotlin.Int origin=null
xx: GET_VAR 'val tmp_5: kotlin.Int [val] declared in <root>.Test2.<init>' type=kotlin.Int origin=null
yy: GET_VAR 'val tmp_4: kotlin.Int [val] declared in <root>.Test2.<init>' type=kotlin.Int origin=null
PROPERTY FAKE_OVERRIDE name:x visibility:public modality:FINAL [fake_override,val]
FUN FAKE_OVERRIDE name:<get-x> visibility:public modality:FINAL <> ($this:<root>.Base) returnType:kotlin.Int [fake_override]
correspondingProperty: PROPERTY FAKE_OVERRIDE name:x visibility:public modality:FINAL [fake_override,val]
@@ -22,12 +22,12 @@ FILE fqName:<root> fileName:/delegatingConstructorCallsInSecondaryConstructors.k
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Test
CONSTRUCTOR visibility:public <> () returnType:<root>.Test
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.Base'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Test modality:FINAL visibility:public superTypes:[<root>.Base]'
CONSTRUCTOR visibility:public <> (xx:kotlin.Int) returnType:<root>.Test
VALUE_PARAMETER name:xx index:0 type:kotlin.Int
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.Base'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Test modality:FINAL visibility:public superTypes:[<root>.Base]'
CONSTRUCTOR visibility:public <> (xx:kotlin.Short) returnType:<root>.Test
VALUE_PARAMETER name:xx index:0 type:kotlin.Short
@@ -33,7 +33,7 @@ FILE fqName:<root> fileName:/secondaryConstructorWithInitializersFromClassBody.k
receiver: GET_VAR '<this>: <root>.TestProperty declared in <root>.TestProperty.<get-x>' type=<root>.TestProperty origin=null
CONSTRUCTOR visibility:public <> () returnType:<root>.TestProperty
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.Base'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:TestProperty modality:FINAL visibility:public superTypes:[<root>.Base]'
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
@@ -66,12 +66,12 @@ FILE fqName:<root> fileName:/secondaryConstructorWithInitializersFromClassBody.k
value: CONST Int type=kotlin.Int value=0
CONSTRUCTOR visibility:public <> () returnType:<root>.TestInitBlock
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.Base'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:TestInitBlock modality:FINAL visibility:public superTypes:[<root>.Base]'
CONSTRUCTOR visibility:public <> (z:kotlin.Any) returnType:<root>.TestInitBlock
VALUE_PARAMETER name:z index:0 type:kotlin.Any
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.Base'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:TestInitBlock modality:FINAL visibility:public superTypes:[<root>.Base]'
CONSTRUCTOR visibility:public <> (y:kotlin.Int) returnType:<root>.TestInitBlock
VALUE_PARAMETER name:y index:0 type:kotlin.Int
@@ -25,7 +25,7 @@ FILE fqName:<root> fileName:/expectClassInherited.kt
CONSTRUCTOR visibility:public <> (i:kotlin.Int) returnType:<root>.B [primary]
VALUE_PARAMETER name:i index:0 type:kotlin.Int
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
DELEGATING_CONSTRUCTOR_CALL 'protected constructor <init> () [primary] declared in <root>.A'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:B modality:OPEN visibility:public [expect] superTypes:[<root>.A]'
FUN name:foo visibility:public modality:OPEN <> ($this:<root>.B) returnType:kotlin.Unit
$this: VALUE_PARAMETER name:<this> type:<root>.B
@@ -22,7 +22,7 @@ FILE fqName:<root> fileName:/expectedSealedClass.kt
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Add
CONSTRUCTOR visibility:public <> () returnType:<root>.Add [primary]
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
DELEGATING_CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.Ops'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Add modality:FINAL visibility:public [expect] superTypes:[<root>.Ops]'
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
+1 -1
View File
@@ -75,7 +75,7 @@ FILE fqName:<root> fileName:/kt16904.kt
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Test1
CONSTRUCTOR visibility:public <> () returnType:<root>.Test1
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in <root>.A'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Test1 modality:FINAL visibility:public superTypes:[<root>.A]'
CALL 'public final fun plusAssign (x: kotlin.Int): kotlin.Unit [operator] declared in <root>.B' type=kotlin.Unit origin=null
$this: CALL 'public final fun <get-x> (): <root>.B declared in <root>.A' type=<root>.B origin=GET_PROPERTY