Change BACKING_FIELD_REQUIRED from SetSlice

This commit is contained in:
Kristoffer Andersen
2022-07-18 14:41:40 +02:00
committed by Alexander Udalov
parent f0bc021b5e
commit 8d79fab109
2 changed files with 2 additions and 3 deletions
@@ -484,7 +484,7 @@ class ControlFlowInformationProviderImpl private constructor(
val variableDescriptor = ctxt.variableDescriptor
val mayBeInitializedNotHere = ctxt.enterInitState?.mayBeInitialized() ?: false
val hasBackingField = (variableDescriptor as? PropertyDescriptor)?.let {
trace.get(BACKING_FIELD_REQUIRED, it)
trace.get(BACKING_FIELD_REQUIRED, it) ?: false
} ?: true
if (variableDescriptor is PropertyDescriptor && variableDescriptor.isVar) {
val descriptor = getEnclosingDescriptor(trace.bindingContext, expression)
@@ -192,7 +192,7 @@ public interface BindingContext {
WritableSlice<Box<DeferredType>, Boolean> DEFERRED_TYPE = Slices.createCollectiveSetSlice();
WritableSlice<PropertyDescriptor, Boolean> BACKING_FIELD_REQUIRED = new SetSlice<PropertyDescriptor>(DO_NOTHING) {
WritableSlice<PropertyDescriptor, Boolean> BACKING_FIELD_REQUIRED = new BasicWritableSlice<PropertyDescriptor, Boolean>(DO_NOTHING) {
@Override
public Boolean computeValue(
SlicedMap map,
@@ -203,7 +203,6 @@ public interface BindingContext {
if (propertyDescriptor.getKind() != CallableMemberDescriptor.Kind.DECLARATION) {
return false;
}
backingFieldRequired = valueNotFound ? false : backingFieldRequired;
PsiElement declarationPsiElement = DescriptorToSourceUtils.descriptorToDeclaration(propertyDescriptor);
if (declarationPsiElement instanceof KtParameter) {
KtParameter jetParameter = (KtParameter) declarationPsiElement;