Fix "not initialized" on lateinit property (KT-9369)
This commit is contained in:
@@ -376,7 +376,8 @@ public class JetFlowInformationProvider {
|
|||||||
boolean isDefinitelyInitialized = ctxt.exitInitState.definitelyInitialized();
|
boolean isDefinitelyInitialized = ctxt.exitInitState.definitelyInitialized();
|
||||||
VariableDescriptor variableDescriptor = ctxt.variableDescriptor;
|
VariableDescriptor variableDescriptor = ctxt.variableDescriptor;
|
||||||
if (variableDescriptor instanceof PropertyDescriptor) {
|
if (variableDescriptor instanceof PropertyDescriptor) {
|
||||||
if (!trace.get(BindingContext.BACKING_FIELD_REQUIRED, (PropertyDescriptor) variableDescriptor)) {
|
PropertyDescriptor propertyDescriptor = (PropertyDescriptor) variableDescriptor;
|
||||||
|
if (propertyDescriptor.isLateInit() || !trace.get(BindingContext.BACKING_FIELD_REQUIRED, propertyDescriptor)) {
|
||||||
isDefinitelyInitialized = true;
|
isDefinitelyInitialized = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,3 +55,11 @@ public abstract class AbstractClass {
|
|||||||
public class AbstractClassImpl : AbstractClass() {
|
public class AbstractClassImpl : AbstractClass() {
|
||||||
override lateinit var str: String
|
override lateinit var str: String
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class B {
|
||||||
|
lateinit var a: String
|
||||||
|
|
||||||
|
init {
|
||||||
|
a.length()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -45,6 +45,14 @@ public final class AbstractClassImpl : AbstractClass {
|
|||||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final class B {
|
||||||
|
public constructor B()
|
||||||
|
public final lateinit var a: kotlin.String
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
|
||||||
public final class CustomDelegate {
|
public final class CustomDelegate {
|
||||||
public constructor CustomDelegate()
|
public constructor CustomDelegate()
|
||||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
|||||||
Reference in New Issue
Block a user