[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
+3
-3
@@ -35,6 +35,9 @@ FILE fqName:<root> fileName:/delegatedMembers.kt
|
||||
BLOCK_BODY
|
||||
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () declared in kotlin.Any'
|
||||
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Test modality:FINAL visibility:public superTypes:[<root>.IBase<TT of <root>.Test>]'
|
||||
FIELD DELEGATE name:$$delegate_0 type:<root>.IBase<TT of <root>.Test> visibility:private [final]
|
||||
EXPRESSION_BODY
|
||||
GET_VAR 'impl: <root>.IBase<TT of <root>.Test> declared in <root>.Test.<init>' type=<root>.IBase<TT of <root>.Test> origin=null
|
||||
FUN DELEGATED_MEMBER name:foo visibility:public modality:OPEN <> ($this:<root>.Test<TT of <root>.Test>, x:kotlin.Int) returnType:kotlin.Unit
|
||||
overridden:
|
||||
public abstract fun foo (x: kotlin.Int): kotlin.Unit declared in <root>.IBase
|
||||
@@ -72,9 +75,6 @@ FILE fqName:<root> fileName:/delegatedMembers.kt
|
||||
CALL 'public abstract fun <get-bar> (): kotlin.Int declared in <root>.IBase' type=kotlin.Int origin=null
|
||||
$this: GET_FIELD 'FIELD DELEGATE name:$$delegate_0 type:<root>.IBase<TT of <root>.Test> visibility:private [final]' type=<root>.IBase<TT of <root>.Test> origin=null
|
||||
receiver: GET_VAR '<this>: <root>.Test<TT of <root>.Test> declared in <root>.Test.<get-bar>' type=<root>.Test<TT of <root>.Test> origin=null
|
||||
FIELD DELEGATE name:$$delegate_0 type:<root>.IBase<TT of <root>.Test> visibility:private [final]
|
||||
EXPRESSION_BODY
|
||||
GET_VAR 'impl: <root>.IBase<TT of <root>.Test> declared in <root>.Test.<init>' type=<root>.IBase<TT of <root>.Test> 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>.IBase
|
||||
|
||||
+2
-2
@@ -15,6 +15,7 @@ class Test<TT : Any?> : IBase<TT> {
|
||||
|
||||
}
|
||||
|
||||
private /* final field */ val $$delegate_0: IBase<TT> = impl
|
||||
override fun foo(x: Int) {
|
||||
<this>.#$$delegate_0.foo(x = x)
|
||||
}
|
||||
@@ -28,6 +29,5 @@ class Test<TT : Any?> : IBase<TT> {
|
||||
return <this>.#$$delegate_0.<get-bar>()
|
||||
}
|
||||
|
||||
private /* final field */ val $$delegate_0: IBase<TT> = impl
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user