Approximate types for lambda literals before serialization
This commit is contained in:
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.descriptors;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.kotlin.name.Name;
|
||||
import org.jetbrains.kotlin.types.KotlinType;
|
||||
import org.jetbrains.kotlin.types.TypeSubstitution;
|
||||
|
||||
import java.util.Collection;
|
||||
@@ -93,6 +94,9 @@ public interface CallableMemberDescriptor extends CallableDescriptor, MemberDesc
|
||||
@NotNull
|
||||
CopyBuilder<D> setPreserveSourceElement();
|
||||
|
||||
@NotNull
|
||||
CopyBuilder<D> setReturnType(@NotNull KotlinType type);
|
||||
|
||||
@Nullable
|
||||
D build();
|
||||
}
|
||||
|
||||
@@ -105,6 +105,7 @@ public interface FunctionDescriptor extends CallableMemberDescriptor {
|
||||
CopyBuilder<D> setTypeParameters(@NotNull List<TypeParameterDescriptor> parameters);
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
CopyBuilder<D> setReturnType(@NotNull KotlinType type);
|
||||
|
||||
@NotNull
|
||||
|
||||
+9
-1
@@ -264,6 +264,7 @@ public class PropertyDescriptorImpl extends VariableDescriptorWithInitializerImp
|
||||
private ReceiverParameterDescriptor dispatchReceiverParameter = PropertyDescriptorImpl.this.dispatchReceiverParameter;
|
||||
private List<TypeParameterDescriptor> newTypeParameters = null;
|
||||
private Name name = getName();
|
||||
private KotlinType returnType = getType();
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
@@ -286,6 +287,13 @@ public class PropertyDescriptorImpl extends VariableDescriptorWithInitializerImp
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public CopyBuilder<PropertyDescriptor> setReturnType(@NotNull KotlinType type) {
|
||||
returnType = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public CopyConfiguration setModality(@NotNull Modality modality) {
|
||||
@@ -386,7 +394,7 @@ public class PropertyDescriptorImpl extends VariableDescriptorWithInitializerImp
|
||||
originalTypeParameters, copyConfiguration.substitution, substitutedDescriptor, substitutedTypeParameters
|
||||
);
|
||||
|
||||
KotlinType originalOutType = getType();
|
||||
KotlinType originalOutType = copyConfiguration.returnType;
|
||||
KotlinType outType = substitutor.substitute(originalOutType, Variance.OUT_VARIANCE);
|
||||
if (outType == null) {
|
||||
return null; // TODO : tell the user that the property was projected out
|
||||
|
||||
Reference in New Issue
Block a user