Remove some usages of KotlinBuiltIns.getInstance()
Introduce DeclarationDescriptor.builtIns extension to get builtins where descriptors are available Introduce various utilities in KotlinBuiltIns to check for primitive types and get fq names of builtins
This commit is contained in:
+1
-1
@@ -103,7 +103,7 @@ public class TypeDeserializer(
|
||||
fun typeArgument(parameter: TypeParameterDescriptor?, typeArgumentProto: ProtoBuf.Type.Argument): TypeProjection {
|
||||
return if (typeArgumentProto.getProjection() == ProtoBuf.Type.Argument.Projection.STAR)
|
||||
if (parameter == null)
|
||||
TypeBasedStarProjectionImpl(KotlinBuiltIns.getInstance().getNullableAnyType())
|
||||
TypeBasedStarProjectionImpl(c.components.moduleDescriptor.builtIns.getNullableAnyType())
|
||||
else
|
||||
StarProjectionImpl(parameter)
|
||||
else TypeProjectionImpl(variance(typeArgumentProto.getProjection()), type(typeArgumentProto.getType()))
|
||||
|
||||
+3
-2
@@ -17,7 +17,6 @@
|
||||
package org.jetbrains.kotlin.serialization.deserialization.descriptors;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.kotlin.builtins.KotlinBuiltIns;
|
||||
import org.jetbrains.kotlin.descriptors.SourceElement;
|
||||
import org.jetbrains.kotlin.descriptors.impl.AbstractLazyTypeParameterDescriptor;
|
||||
import org.jetbrains.kotlin.serialization.ProtoBuf;
|
||||
@@ -30,6 +29,8 @@ import java.util.Collections;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import static org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilPackage.getBuiltIns;
|
||||
|
||||
public class DeserializedTypeParameterDescriptor extends AbstractLazyTypeParameterDescriptor {
|
||||
private final ProtoBuf.TypeParameter proto;
|
||||
private final TypeDeserializer typeDeserializer;
|
||||
@@ -50,7 +51,7 @@ public class DeserializedTypeParameterDescriptor extends AbstractLazyTypeParamet
|
||||
@Override
|
||||
protected Set<JetType> resolveUpperBounds() {
|
||||
if (proto.getUpperBoundCount() == 0) {
|
||||
return Collections.singleton(KotlinBuiltIns.getInstance().getDefaultBound());
|
||||
return Collections.singleton(getBuiltIns(this).getDefaultBound());
|
||||
}
|
||||
Set<JetType> result = new LinkedHashSet<JetType>(proto.getUpperBoundCount());
|
||||
for (ProtoBuf.Type upperBound : proto.getUpperBoundList()) {
|
||||
|
||||
Reference in New Issue
Block a user