FIR: introduce delegate field initializers

Before this commit we initialized delegate fields in primary constructor,
that could provoke NPE in case delegate is used in initializer of
some property backing field.
Now we initialize delegate fields directly instead.
This commit is contained in:
Mikhail Glukhikh
2021-02-02 17:51:11 +03:00
parent 2cbdad0bb1
commit d4b0688690
69 changed files with 928 additions and 356 deletions
@@ -6,9 +6,6 @@ FILE fqName:<root> fileName:/DelegationAndInheritanceFromJava.kt
BLOCK_BODY
DELEGATING_CONSTRUCTOR_CALL 'public constructor <init> () [primary] declared in kotlin.Any'
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:Impl modality:FINAL visibility:public superTypes:[<root>.Foo.A; <root>.Foo.B]'
SET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:<root>.Foo.B visibility:local [final]' type=kotlin.Unit origin=EQ
receiver: GET_VAR '<this>: <root>.Impl declared in <root>.Impl' type=<root>.Impl origin=null
value: GET_VAR 'b: <root>.Foo.B declared in <root>.Impl.<init>' type=<root>.Foo.B origin=null
FUN DELEGATED_MEMBER name:add visibility:public modality:OPEN <> ($this:<root>.Impl, element:kotlin.String?) returnType:kotlin.Boolean
overridden:
public abstract fun add (element: E of kotlin.collections.MutableSet): kotlin.Boolean declared in kotlin.collections.MutableSet
@@ -124,6 +121,8 @@ FILE fqName:<root> fileName:/DelegationAndInheritanceFromJava.kt
$this: GET_FIELD 'FIELD DELEGATE name:<$$delegate_0> type:<root>.Foo.B visibility:local [final]' type=<root>.Foo.B origin=null
receiver: GET_VAR '<this>: <root>.Impl declared in <root>.Impl.<get-size>' type=<root>.Impl origin=null
FIELD DELEGATE name:<$$delegate_0> type:<root>.Foo.B visibility:local [final]
EXPRESSION_BODY
GET_VAR 'b: <root>.Foo.B declared in <root>.Impl.<init>' type=<root>.Foo.B 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 [operator] declared in kotlin.Any