Substitute lambda's receiver type during completion including the builder inference stub variables substitution

^KT-42175 Fixed
This commit is contained in:
Victor Petukhov
2020-12-25 17:27:06 +03:00
parent 672859d447
commit 37473ad640
10 changed files with 84 additions and 3 deletions
@@ -21,10 +21,12 @@ import org.jetbrains.kotlin.descriptors.DeclarationDescriptor;
import org.jetbrains.kotlin.descriptors.ReceiverParameterDescriptor;
import org.jetbrains.kotlin.descriptors.annotations.Annotations;
import org.jetbrains.kotlin.resolve.scopes.receivers.ReceiverValue;
import org.jetbrains.kotlin.types.KotlinType;
import org.jetbrains.kotlin.types.typeUtil.TypeUtilsKt;
public class ReceiverParameterDescriptorImpl extends AbstractReceiverParameterDescriptor {
private final DeclarationDescriptor containingDeclaration;
private final ReceiverValue value;
private ReceiverValue value;
public ReceiverParameterDescriptorImpl(
@NotNull DeclarationDescriptor containingDeclaration,
@@ -53,4 +55,9 @@ public class ReceiverParameterDescriptorImpl extends AbstractReceiverParameterDe
public ReceiverParameterDescriptor copy(@NotNull DeclarationDescriptor newOwner) {
return new ReceiverParameterDescriptorImpl(newOwner, value, getAnnotations());
}
public void setOutType(@NotNull KotlinType outType) {
assert TypeUtilsKt.shouldBeSubstituted(this.value.getType());
this.value = value.replaceType(outType);
}
}