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
@@ -3,13 +3,8 @@ class Test : J {
super/*Any*/()
/* <init>() */
<this>.#<$$delegate_0> = j
}
private val j: J
field = j
private get
override fun takeNotNull(x: @EnhancedNullability String) {
<this>.#<$$delegate_0>.takeNotNull(x = x)
}
@@ -36,7 +31,10 @@ class Test : J {
return <this>.#<$$delegate_0>.returnsFlexible()
}
local /* final field */ val <$$delegate_0>: J
local /* final field */ val <$$delegate_0>: J = j
private val j: J
field = j
private get
}