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:
@@ -13,13 +13,12 @@ FILE: delegatedSuperType.kt
|
||||
|
||||
}
|
||||
public final class C : R|A| {
|
||||
local final field <$$delegate_0>: R|A|
|
||||
|
||||
public constructor(b: R|B|): R|C| {
|
||||
super<R|kotlin/Any|>()
|
||||
this@R|/C|.R|<local>/<$$delegate_0>| = R|<local>/b|
|
||||
}
|
||||
|
||||
local final field <$$delegate_0>: R|A| = R|<local>/b|
|
||||
|
||||
public final val b: R|B| = R|<local>/b|
|
||||
public get(): R|B|
|
||||
|
||||
|
||||
+4
-6
@@ -9,25 +9,23 @@ FILE: anonymousObjectByDelegate.kt
|
||||
}
|
||||
public final fun R|A|.test_1(): R|kotlin/Unit| {
|
||||
object : R|B| {
|
||||
local final field <$$delegate_0>: R|B|
|
||||
|
||||
private constructor(): R|<anonymous>| {
|
||||
super<R|kotlin/Any|>()
|
||||
this@R|/<anonymous>|.R|<local>/<$$delegate_0>| = this@R|/test_1|.R|/A.b|
|
||||
}
|
||||
|
||||
local final field <$$delegate_0>: R|B| = this@R|/test_1|.R|/A.b|
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
public final fun R|A|.test_2(): R|kotlin/Unit| {
|
||||
object : R|B| {
|
||||
local final field <$$delegate_0>: R|B|
|
||||
|
||||
private constructor(): R|<anonymous>| {
|
||||
super<R|kotlin/Any|>()
|
||||
this@R|/<anonymous>|.R|<local>/<$$delegate_0>| = this@R|/test_2|.R|/A.b|
|
||||
}
|
||||
|
||||
local final field <$$delegate_0>: R|B| = this@R|/test_2|.R|/A.b|
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -6,7 +6,7 @@ FILE: delegationInInterface.kt
|
||||
|
||||
}
|
||||
public abstract interface B : R|A| {
|
||||
local final field <$$delegate_0>: R|A|
|
||||
local final field <$$delegate_0>: R|A| = <Unresolved name: a>#
|
||||
|
||||
public abstract val a: R|A|
|
||||
public get(): R|A|
|
||||
@@ -15,6 +15,6 @@ FILE: delegationInInterface.kt
|
||||
public final val test: R|A| = R|/A.A|()
|
||||
public get(): R|A|
|
||||
public abstract interface C : R|A| {
|
||||
local final field <$$delegate_0>: R|A|
|
||||
local final field <$$delegate_0>: R|A| = R|/test|
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
class A
|
||||
|
||||
interface B : <!DELEGATION_IN_INTERFACE, INTERFACE_WITH_SUPERCLASS!>A<!> by a {
|
||||
interface B : <!DELEGATION_IN_INTERFACE, INTERFACE_WITH_SUPERCLASS!>A<!> by <!UNRESOLVED_REFERENCE!>a<!> {
|
||||
val a: A
|
||||
}
|
||||
|
||||
|
||||
+2
-3
@@ -4,13 +4,12 @@ FILE: superCallWithDelegation.kt
|
||||
|
||||
}
|
||||
public open class B : R|A| {
|
||||
local final field <$$delegate_0>: R|A|
|
||||
|
||||
public constructor(a: R|A|): R|B| {
|
||||
super<R|kotlin/Any|>()
|
||||
this@R|/B|.R|<local>/<$$delegate_0>| = R|<local>/a|
|
||||
}
|
||||
|
||||
local final field <$$delegate_0>: R|A| = R|<local>/a|
|
||||
|
||||
private final val a: R|A| = R|<local>/a|
|
||||
private get(): R|A|
|
||||
|
||||
|
||||
Reference in New Issue
Block a user