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();
|
||||
VariableDescriptor variableDescriptor = ctxt.variableDescriptor;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,4 +54,12 @@ public abstract class AbstractClass {
|
||||
|
||||
public class AbstractClassImpl : AbstractClass() {
|
||||
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 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 constructor CustomDelegate()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
|
||||
Reference in New Issue
Block a user