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:
+6
-9
@@ -14,7 +14,6 @@ class Test1<E : Any?> : IBase<E> {
|
||||
super/*Any*/()
|
||||
/* <init>() */
|
||||
|
||||
<this>.#<$$delegate_0> = i
|
||||
}
|
||||
|
||||
override fun <B : Any?> foo(a: E, b: B) {
|
||||
@@ -34,7 +33,7 @@ class Test1<E : Any?> : IBase<E> {
|
||||
(<this>.#<$$delegate_0>, <this>).<set-x></* null */>(<set-?> = <set-?>)
|
||||
}
|
||||
|
||||
local /* final field */ val <$$delegate_0>: IBase<E>
|
||||
local /* final field */ val <$$delegate_0>: IBase<E> = i
|
||||
|
||||
}
|
||||
|
||||
@@ -43,14 +42,8 @@ class Test2 : IBase<String> {
|
||||
super/*Any*/()
|
||||
/* <init>() */
|
||||
|
||||
<this>.#<$$delegate_0> = j
|
||||
}
|
||||
|
||||
var j: IBase<String>
|
||||
field = j
|
||||
get
|
||||
set
|
||||
|
||||
override fun <B : Any?> foo(a: String, b: B) {
|
||||
<this>.#<$$delegate_0>.foo</* null */>(a = a, b = b)
|
||||
}
|
||||
@@ -68,7 +61,11 @@ class Test2 : IBase<String> {
|
||||
(<this>.#<$$delegate_0>, <this>).<set-x></* null */>(<set-?> = <set-?>)
|
||||
}
|
||||
|
||||
local /* final field */ val <$$delegate_0>: IBase<String>
|
||||
local /* final field */ val <$$delegate_0>: IBase<String> = j
|
||||
var j: IBase<String>
|
||||
field = j
|
||||
get
|
||||
set
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user