[FIR2IR] Automatically store IR declaration in its parent upon creation
Previously, creating a declaration with Fir2IrCallableDeclarationsGenerator/ Fir2IrClassifiersGenerator didn't guarantee that this declaration will be actually added to the list of parent class/file declarations, which lead to situations when FIR2IR created some declarations in the air (mostly fake-overrides)
This commit is contained in:
committed by
Space Team
parent
22f55b3dc4
commit
3d6ec0ec75
+6
-6
@@ -72,17 +72,17 @@ FILE fqName:<root> fileName:/selfReferentialAnnotation.kt
|
||||
receiver: GET_VAR '<this>: <root>.MyRequiresOptIn declared in <root>.MyRequiresOptIn.<get-b>' type=<root>.MyRequiresOptIn origin=null
|
||||
CLASS ENUM_CLASS name:MyLevel modality:FINAL visibility:public superTypes:[kotlin.Enum<<root>.MyRequiresOptIn.MyLevel>]
|
||||
$this: VALUE_PARAMETER INSTANCE_RECEIVER name:<this> type:<root>.MyRequiresOptIn.MyLevel
|
||||
ENUM_ENTRY name:ERROR
|
||||
init: EXPRESSION_BODY
|
||||
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () declared in <root>.MyRequiresOptIn.MyLevel'
|
||||
ENUM_ENTRY name:WARNING
|
||||
init: EXPRESSION_BODY
|
||||
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () declared in <root>.MyRequiresOptIn.MyLevel'
|
||||
CONSTRUCTOR visibility:private <> () returnType:<root>.MyRequiresOptIn.MyLevel [primary]
|
||||
BLOCK_BODY
|
||||
ENUM_CONSTRUCTOR_CALL 'public constructor <init> (name: kotlin.String, ordinal: kotlin.Int) declared in kotlin.Enum'
|
||||
<E>: <root>.MyRequiresOptIn.MyLevel
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS ENUM_CLASS name:MyLevel modality:FINAL visibility:public superTypes:[kotlin.Enum<<root>.MyRequiresOptIn.MyLevel>]'
|
||||
ENUM_ENTRY name:WARNING
|
||||
init: EXPRESSION_BODY
|
||||
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () declared in <root>.MyRequiresOptIn.MyLevel'
|
||||
ENUM_ENTRY name:ERROR
|
||||
init: EXPRESSION_BODY
|
||||
ENUM_CONSTRUCTOR_CALL 'private constructor <init> () declared in <root>.MyRequiresOptIn.MyLevel'
|
||||
FUN ENUM_CLASS_SPECIAL_MEMBER name:values visibility:public modality:FINAL <> () returnType:kotlin.Array<<root>.MyRequiresOptIn.MyLevel>
|
||||
SYNTHETIC_BODY kind=ENUM_VALUES
|
||||
FUN ENUM_CLASS_SPECIAL_MEMBER name:valueOf visibility:public modality:FINAL <> (value:kotlin.String) returnType:<root>.MyRequiresOptIn.MyLevel
|
||||
|
||||
+3
-3
@@ -114,6 +114,9 @@ FILE fqName:<root> fileName:/delegationToIntersectionType.kt
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:<no name provided> modality:FINAL visibility:local superTypes:[<root>.B]'
|
||||
FIELD DELEGATE name:$$delegate_0 type:<root>.A visibility:private [final]
|
||||
EXPRESSION_BODY
|
||||
GET_VAR 'val intersection: <root>.A declared in <root>.test' type=<root>.A origin=null
|
||||
FUN DELEGATED_MEMBER name:foo visibility:public modality:OPEN <> ($this:<root>.test.<no name provided>) returnType:kotlin.String
|
||||
overridden:
|
||||
public abstract fun foo (): kotlin.String declared in <root>.B
|
||||
@@ -124,9 +127,6 @@ FILE fqName:<root> fileName:/delegationToIntersectionType.kt
|
||||
$this: TYPE_OP type=<root>.B origin=IMPLICIT_CAST typeOperand=<root>.B
|
||||
GET_FIELD 'FIELD DELEGATE name:$$delegate_0 type:<root>.A visibility:private [final]' type=<root>.A origin=null
|
||||
receiver: GET_VAR '<this>: <root>.test.<no name provided> declared in <root>.test.<no name provided>.foo' type=<root>.test.<no name provided> origin=null
|
||||
FIELD DELEGATE name:$$delegate_0 type:<root>.A visibility:private [final]
|
||||
EXPRESSION_BODY
|
||||
GET_VAR 'val intersection: <root>.A declared in <root>.test' type=<root>.A origin=null
|
||||
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 declared in <root>.B
|
||||
|
||||
+3
-3
@@ -119,6 +119,9 @@ FILE fqName:<root> fileName:/delegationToIntersectionType2.kt
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:<no name provided> modality:FINAL visibility:local superTypes:[<root>.A]'
|
||||
FIELD DELEGATE name:$$delegate_0 type:<root>.A visibility:private [final]
|
||||
EXPRESSION_BODY
|
||||
GET_VAR 'val intersection: <root>.A declared in <root>.test' type=<root>.A origin=null
|
||||
FUN DELEGATED_MEMBER name:foo visibility:public modality:OPEN <> ($this:<root>.test.<no name provided>) returnType:kotlin.Any
|
||||
overridden:
|
||||
public abstract fun foo (): kotlin.Any declared in <root>.A
|
||||
@@ -129,9 +132,6 @@ FILE fqName:<root> fileName:/delegationToIntersectionType2.kt
|
||||
$this: TYPE_OP type=<root>.B origin=IMPLICIT_CAST typeOperand=<root>.B
|
||||
GET_FIELD 'FIELD DELEGATE name:$$delegate_0 type:<root>.A visibility:private [final]' type=<root>.A origin=null
|
||||
receiver: GET_VAR '<this>: <root>.test.<no name provided> declared in <root>.test.<no name provided>.foo' type=<root>.test.<no name provided> origin=null
|
||||
FIELD DELEGATE name:$$delegate_0 type:<root>.A visibility:private [final]
|
||||
EXPRESSION_BODY
|
||||
GET_VAR 'val intersection: <root>.A declared in <root>.test' type=<root>.A origin=null
|
||||
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 declared in <root>.A
|
||||
|
||||
compiler/testData/codegen/box/functions/delegatedPropertyWithMultipleOverriddens_generics.fir.ir.txt
Vendored
+4
-4
@@ -197,6 +197,10 @@ FILE fqName:<root> fileName:/delegatedPropertyWithMultipleOverriddens_generics.k
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:MC modality:FINAL visibility:public superTypes:[<root>.MyMutableCollection<kotlin.String>]'
|
||||
FIELD DELEGATE name:$$delegate_0 type:<root>.MyArrayList<kotlin.String> visibility:private [final]
|
||||
EXPRESSION_BODY
|
||||
CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.MyArrayList' type=<root>.MyArrayList<kotlin.String> origin=null
|
||||
<class: E6>: kotlin.String
|
||||
FUN DELEGATED_MEMBER name:foo visibility:public modality:OPEN <> ($this:<root>.MC) returnType:kotlin.String
|
||||
overridden:
|
||||
public abstract fun foo (): E3 of <root>.MyMutableCollection declared in <root>.MyMutableCollection
|
||||
@@ -219,10 +223,6 @@ FILE fqName:<root> fileName:/delegatedPropertyWithMultipleOverriddens_generics.k
|
||||
CALL 'public open fun <get-bar> (): E6 of <root>.MyArrayList declared in <root>.MyArrayList' type=E6 of <root>.MyArrayList origin=null
|
||||
$this: GET_FIELD 'FIELD DELEGATE name:$$delegate_0 type:<root>.MyArrayList<kotlin.String> visibility:private [final]' type=<root>.MyArrayList<kotlin.String> origin=null
|
||||
receiver: GET_VAR '<this>: <root>.MC declared in <root>.MC.<get-bar>' type=<root>.MC origin=null
|
||||
FIELD DELEGATE name:$$delegate_0 type:<root>.MyArrayList<kotlin.String> visibility:private [final]
|
||||
EXPRESSION_BODY
|
||||
CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.MyArrayList' type=<root>.MyArrayList<kotlin.String> origin=null
|
||||
<class: E6>: kotlin.String
|
||||
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 declared in <root>.MyMutableCollection
|
||||
|
||||
+3
-3
@@ -188,6 +188,9 @@ FILE fqName:<root> fileName:/delegatedPropertyWithMultipleOverriddens_noGenerics
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:MC modality:FINAL visibility:public superTypes:[<root>.MyMutableCollection]'
|
||||
FIELD DELEGATE name:$$delegate_0 type:<root>.MyArrayList visibility:private [final]
|
||||
EXPRESSION_BODY
|
||||
CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.MyArrayList' type=<root>.MyArrayList origin=null
|
||||
FUN DELEGATED_MEMBER name:foo visibility:public modality:OPEN <> ($this:<root>.MC) returnType:kotlin.String
|
||||
overridden:
|
||||
public abstract fun foo (): kotlin.String declared in <root>.MyMutableCollection
|
||||
@@ -210,9 +213,6 @@ FILE fqName:<root> fileName:/delegatedPropertyWithMultipleOverriddens_noGenerics
|
||||
CALL 'public open fun <get-bar> (): kotlin.String declared in <root>.MyArrayList' type=kotlin.String origin=null
|
||||
$this: GET_FIELD 'FIELD DELEGATE name:$$delegate_0 type:<root>.MyArrayList visibility:private [final]' type=<root>.MyArrayList origin=null
|
||||
receiver: GET_VAR '<this>: <root>.MC declared in <root>.MC.<get-bar>' type=<root>.MC origin=null
|
||||
FIELD DELEGATE name:$$delegate_0 type:<root>.MyArrayList visibility:private [final]
|
||||
EXPRESSION_BODY
|
||||
CONSTRUCTOR_CALL 'public constructor <init> () declared in <root>.MyArrayList' type=<root>.MyArrayList origin=null
|
||||
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 declared in <root>.MyMutableCollection
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
// !LANGUAGE: +MultiPlatformProjects
|
||||
// IGNORE_CODEGEN_WITH_IR_FAKE_OVERRIDE_GENERATION: KT-62535
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND_K2: JVM_IR
|
||||
// REASON: K2 incorrectly generates IR for B.bar f/o
|
||||
// MODULE: common
|
||||
// TARGET_PLATFORM: Common
|
||||
|
||||
|
||||
-2
@@ -2,8 +2,6 @@
|
||||
// WITH_STDLIB
|
||||
// IGNORE_CODEGEN_WITH_IR_FAKE_OVERRIDE_GENERATION: KT-62535
|
||||
// !LANGUAGE: +MultiPlatformProjects
|
||||
// IGNORE_BACKEND_K2: ANY
|
||||
// REASON: K2 incorrectly generates IR for S2.s3 f/o
|
||||
|
||||
// MODULE: common
|
||||
// TARGET_PLATFORM: Common
|
||||
|
||||
Reference in New Issue
Block a user