FIR2IR: fix origin of object literal constructor call

This commit is contained in:
Mikhail Glukhikh
2020-03-11 10:05:27 +03:00
parent 8231377f6b
commit 47ebd38534
10 changed files with 16 additions and 15 deletions
@@ -829,7 +829,8 @@ class Fir2IrVisitor(
endOffset,
anonymousClassType,
anonymousClass.constructors.first().symbol,
anonymousClass.typeParameters.size
anonymousClass.typeParameters.size,
origin = IrStatementOrigin.OBJECT_LITERAL
)
)
)
@@ -162,7 +162,7 @@ FILE fqName:<root> fileName:/delegatedImplementation.kt
$receiver: VALUE_PARAMETER name:<this> type:kotlin.Byte
VALUE_PARAMETER name:value index:0 type:kotlin.Int
BLOCK_BODY
CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.otherImpl.<no name provided>' type=<root>.otherImpl.<no name provided> origin=null
CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.otherImpl.<no name provided>' type=<root>.otherImpl.<no name provided> origin=OBJECT_LITERAL
CLASS CLASS name:Test1 modality:FINAL visibility:public superTypes:[<root>.IBase]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.Test1
CONSTRUCTOR visibility:public <> () returnType:<root>.Test1 [primary]
@@ -62,7 +62,7 @@ FILE fqName:<root> fileName:/lambdaInDataClassDefaultParameter.kt
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:<no name provided> modality:FINAL visibility:local superTypes:[kotlin.Any]'
CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.B.<init>.<no name provided>' type=<root>.B.<init>.<no name provided> origin=null
CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.B.<init>.<no name provided>' type=<root>.B.<init>.<no name provided> origin=OBJECT_LITERAL
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:B modality:FINAL visibility:public [data] superTypes:[kotlin.Any]'
@@ -26,7 +26,7 @@ FILE fqName:<root> fileName:/objectLiteralExpressions.kt
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:<no name provided> modality:FINAL visibility:local superTypes:[kotlin.Any]'
CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.test1.<no name provided>' type=<root>.test1.<no name provided> origin=null
CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.test1.<no name provided>' type=<root>.test1.<no name provided> origin=OBJECT_LITERAL
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-test1> visibility:public modality:FINAL <> () returnType:<root>.test1.<no name provided>
correspondingProperty: PROPERTY name:test1 visibility:public modality:FINAL [val]
BLOCK_BODY
@@ -47,7 +47,7 @@ FILE fqName:<root> fileName:/objectLiteralExpressions.kt
BLOCK_BODY
CALL 'public final fun println (message: kotlin.Any?): kotlin.Unit [inline] declared in kotlin.io' type=kotlin.Unit origin=null
message: CONST String type=kotlin.String value="foo"
CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.test2.<no name provided>' type=<root>.test2.<no name provided> origin=null
CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.test2.<no name provided>' type=<root>.test2.<no name provided> origin=OBJECT_LITERAL
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-test2> visibility:public modality:FINAL <> () returnType:<root>.test2.<no name provided>
correspondingProperty: PROPERTY name:test2 visibility:public modality:FINAL [val]
BLOCK_BODY
@@ -98,7 +98,7 @@ FILE fqName:<root> fileName:/objectLiteralExpressions.kt
BLOCK_BODY
CALL 'public final fun println (message: kotlin.Any?): kotlin.Unit [inline] declared in kotlin.io' type=kotlin.Unit origin=null
message: CONST String type=kotlin.String value="foo"
CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.Outer.test3.<no name provided>' type=<root>.Outer.test3.<no name provided> origin=null
CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.Outer.test3.<no name provided>' type=<root>.Outer.test3.<no name provided> origin=OBJECT_LITERAL
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
@@ -128,4 +128,4 @@ FILE fqName:<root> fileName:/objectLiteralExpressions.kt
BLOCK_BODY
CALL 'public final fun println (message: kotlin.Any?): kotlin.Unit [inline] declared in kotlin.io' type=kotlin.Unit origin=null
message: CONST String type=kotlin.String value="foo"
CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.test4.<no name provided>' type=<root>.test4.<no name provided> origin=null
CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.test4.<no name provided>' type=<root>.test4.<no name provided> origin=OBJECT_LITERAL
@@ -88,7 +88,7 @@ FILE fqName:<root> fileName:/enumEntryReferenceFromEnumEntryClass.kt
value: CONST Int type=kotlin.Int value=1
CALL 'public final fun foo (): kotlin.Unit declared in <root>.MyEnum.Z' type=kotlin.Unit origin=null
$this: GET_VAR '<this>: <root>.MyEnum.Z declared in <root>.MyEnum.Z' type=<root>.MyEnum.Z origin=null
CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.MyEnum.Z.anObject.<no name provided>' type=<root>.MyEnum.Z.anObject.<no name provided> origin=null
CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.MyEnum.Z.anObject.<no name provided>' type=<root>.MyEnum.Z.anObject.<no name provided> origin=OBJECT_LITERAL
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-anObject> visibility:public modality:FINAL <> ($this:<root>.MyEnum.Z) returnType:<root>.MyEnum.Z.anObject.<no name provided>
correspondingProperty: PROPERTY name:anObject visibility:public modality:FINAL [val]
$this: VALUE_PARAMETER name:<this> type:<root>.MyEnum.Z
@@ -73,7 +73,7 @@ FILE fqName:<root> fileName:/partialSam.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun run (s: kotlin.String, i: kotlin.Int, t: kotlin.String): kotlin.Int declared in <root>.fsi.<no name provided>'
CONST Int type=kotlin.Int value=1
CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.fsi.<no name provided>' type=<root>.fsi.<no name provided> origin=null
CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.fsi.<no name provided>' type=<root>.fsi.<no name provided> origin=OBJECT_LITERAL
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-fsi> visibility:public modality:FINAL <> () returnType:<root>.fsi.<no name provided>
correspondingProperty: PROPERTY name:fsi visibility:public modality:FINAL [val]
BLOCK_BODY
@@ -97,7 +97,7 @@ FILE fqName:<root> fileName:/partialSam.kt
BLOCK_BODY
RETURN type=kotlin.Nothing from='public final fun run (s: kotlin.String, i: kotlin.Int, t: kotlin.Int): kotlin.String declared in <root>.fis.<no name provided>'
CONST String type=kotlin.String value=""
CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.fis.<no name provided>' type=<root>.fis.<no name provided> origin=null
CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.fis.<no name provided>' type=<root>.fis.<no name provided> origin=OBJECT_LITERAL
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-fis> visibility:public modality:FINAL <> () returnType:<root>.fis.<no name provided>
correspondingProperty: PROPERTY name:fis visibility:public modality:FINAL [val]
BLOCK_BODY
@@ -94,7 +94,7 @@ FILE fqName:<root> fileName:/multipleThisReferences.kt
RETURN type=kotlin.Nothing from='public final fun <get-xx> (): kotlin.Int declared in <root>.Host.test.<no name provided>'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:xx type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null
receiver: GET_VAR '<this>: <root>.Host.test.<no name provided> declared in <root>.Host.test.<no name provided>.<get-xx>' type=<root>.Host.test.<no name provided> origin=null
CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.Host.test.<no name provided>' type=<root>.Host.test.<no name provided> origin=null
CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.Host.test.<no name provided>' type=<root>.Host.test.<no name provided> origin=OBJECT_LITERAL
FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator]
overridden:
public open fun equals (other: kotlin.Any?): kotlin.Boolean [operator] declared in kotlin.Any
@@ -142,7 +142,7 @@ FILE fqName:<root> fileName:/objectReference.kt
value: CONST Int type=kotlin.Int value=1
CALL 'public final fun foo (): kotlin.Unit declared in <root>.Z' type=kotlin.Unit origin=null
$this: GET_OBJECT 'CLASS OBJECT name:Z modality:FINAL visibility:public superTypes:[kotlin.Any]' type=<root>.Z
CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.Z.anObject.<no name provided>' type=<root>.Z.anObject.<no name provided> origin=null
CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.Z.anObject.<no name provided>' type=<root>.Z.anObject.<no name provided> origin=OBJECT_LITERAL
FUN DEFAULT_PROPERTY_ACCESSOR name:<get-anObject> visibility:public modality:FINAL <> ($this:<root>.Z) returnType:<root>.Z.anObject.<no name provided>
correspondingProperty: PROPERTY name:anObject visibility:public modality:FINAL [val]
$this: VALUE_PARAMETER name:<this> type:<root>.Z
@@ -89,4 +89,4 @@ FILE fqName:<root> fileName:/thisOfGenericOuterClass.kt
RETURN type=kotlin.Nothing from='public final fun <get-xx> (): kotlin.Int declared in <root>.test.<no name provided>'
GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:xx type:kotlin.Int visibility:private [final]' type=kotlin.Int origin=null
receiver: GET_VAR '<this>: <root>.test.<no name provided> declared in <root>.test.<no name provided>.<get-xx>' type=<root>.test.<no name provided> origin=null
CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.test.<no name provided>' type=<root>.test.<no name provided> origin=null
CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.test.<no name provided>' type=<root>.test.<no name provided> origin=OBJECT_LITERAL
@@ -10,7 +10,7 @@ FILE fqName:<root> fileName:/thisReferenceBeforeClassDeclared.kt
BLOCK_BODY
ERROR_CALL 'Cannot find delegated constructor call' type=<root>.test.<no name provided>
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:<no name provided> modality:FINAL visibility:local superTypes:[<root>.WithCompanion]'
CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.test.<no name provided>' type=<root>.test.<no name provided> origin=null
CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.test.<no name provided>' type=<root>.test.<no name provided> origin=OBJECT_LITERAL
VAR name:test2 type:<root>.test.<no name provided> [val]
BLOCK type=<root>.test.<no name provided> origin=OBJECT_LITERAL
CLASS CLASS name:<no name provided> modality:FINAL visibility:local superTypes:[<root>.WithCompanion]
@@ -20,7 +20,7 @@ FILE fqName:<root> fileName:/thisReferenceBeforeClassDeclared.kt
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> (a: <root>.WithCompanion.Companion) [primary] declared in <root>.WithCompanion'
a: ERROR_CALL 'Unresolved reference: <Unresolved name: foo>#' type=IrErrorType
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:<no name provided> modality:FINAL visibility:local superTypes:[<root>.WithCompanion]'
CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.test.<no name provided>' type=<root>.test.<no name provided> origin=null
CONSTRUCTOR_CALL 'private constructor <init> () [primary] declared in <root>.test.<no name provided>' type=<root>.test.<no name provided> origin=OBJECT_LITERAL
CLASS CLASS name:WithCompanion modality:OPEN visibility:public superTypes:[kotlin.Any]
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.WithCompanion
CONSTRUCTOR visibility:public <> (a:<root>.WithCompanion.Companion) returnType:<root>.WithCompanion [primary]