Minor. Removed TypeParameterDescriptor#getLowerBounds
This commit is contained in:
@@ -321,7 +321,7 @@ class TypeResolver(
|
||||
KotlinTypeImpl.create(
|
||||
annotations,
|
||||
typeParameter.typeConstructor,
|
||||
TypeUtils.hasNullableLowerBound(typeParameter),
|
||||
false,
|
||||
listOf(),
|
||||
scopeForTypeParameter)
|
||||
}
|
||||
|
||||
-1
@@ -562,7 +562,6 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements ClassDes
|
||||
getTypeConstructor().getSupertypes();
|
||||
for (TypeParameterDescriptor typeParameterDescriptor : getTypeConstructor().getParameters()) {
|
||||
typeParameterDescriptor.getUpperBounds();
|
||||
typeParameterDescriptor.getLowerBounds();
|
||||
}
|
||||
getUnsubstitutedPrimaryConstructor();
|
||||
getVisibility();
|
||||
|
||||
-1
@@ -143,7 +143,6 @@ public class LazyTypeParameterDescriptor extends AbstractLazyTypeParameterDescri
|
||||
getContainingDeclaration();
|
||||
getDefaultType();
|
||||
getIndex();
|
||||
ForceResolveUtil.forceResolveAllContents(getLowerBounds());
|
||||
getOriginal();
|
||||
ForceResolveUtil.forceResolveAllContents(getTypeConstructor());
|
||||
ForceResolveUtil.forceResolveAllContents(getUpperBounds());
|
||||
|
||||
+2
-1
@@ -22,6 +22,7 @@ import org.jetbrains.kotlin.descriptors.TypeParameterDescriptor
|
||||
import org.jetbrains.kotlin.load.java.components.TypeUsage
|
||||
import org.jetbrains.kotlin.renderer.CustomFlexibleRendering
|
||||
import org.jetbrains.kotlin.renderer.DescriptorRenderer
|
||||
import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns
|
||||
import org.jetbrains.kotlin.types.*
|
||||
|
||||
object RawTypeTag : TypeCapability
|
||||
@@ -150,7 +151,7 @@ internal object RawSubstitution : TypeSubstitution() {
|
||||
JavaTypeFlexibility.FLEXIBLE_UPPER_BOUND, JavaTypeFlexibility.INFLEXIBLE -> {
|
||||
if (!parameter.variance.allowsOutPosition)
|
||||
// in T -> Comparable<Nothing>
|
||||
TypeProjectionImpl(Variance.INVARIANT, parameter.lowerBounds.first())
|
||||
TypeProjectionImpl(Variance.INVARIANT, parameter.builtIns.nothingType)
|
||||
else if (erasedUpperBound.constructor.parameters.isNotEmpty())
|
||||
// T : Enum<E> -> out Enum<*>
|
||||
TypeProjectionImpl(Variance.OUT_VARIANCE, erasedUpperBound)
|
||||
|
||||
@@ -33,9 +33,6 @@ public interface TypeParameterDescriptor extends ClassifierDescriptor {
|
||||
@NotNull
|
||||
List<KotlinType> getUpperBounds();
|
||||
|
||||
@NotNull
|
||||
List<KotlinType> getLowerBounds();
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
TypeConstructor getTypeConstructor();
|
||||
|
||||
-6
@@ -181,12 +181,6 @@ public abstract class AbstractTypeParameterDescriptor extends DeclarationDescrip
|
||||
return defaultType.invoke();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<KotlinType> getLowerBounds() {
|
||||
return Collections.singletonList(getBuiltIns(this).getNothingType());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
@Deprecated
|
||||
|
||||
@@ -304,15 +304,6 @@ public class TypeUtils {
|
||||
return result;
|
||||
}
|
||||
|
||||
public static boolean hasNullableLowerBound(@NotNull TypeParameterDescriptor typeParameterDescriptor) {
|
||||
for (KotlinType bound : typeParameterDescriptor.getLowerBounds()) {
|
||||
if (bound.isMarkedNullable()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* A work-around of the generic nullability problem in the type checker
|
||||
* Semantics should be the same as `!isSubtype(T, Any)`
|
||||
@@ -343,8 +334,7 @@ public class TypeUtils {
|
||||
if (FlexibleTypesKt.isFlexible(type) && acceptsNullable(FlexibleTypesKt.flexibility(type).getUpperBound())) {
|
||||
return true;
|
||||
}
|
||||
TypeParameterDescriptor typeParameterDescriptor = getTypeParameterDescriptorOrNull(type);
|
||||
return typeParameterDescriptor != null && hasNullableLowerBound(typeParameterDescriptor);
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean hasNullableSuperType(@NotNull KotlinType type) {
|
||||
|
||||
@@ -72,7 +72,6 @@ class FuzzyType(
|
||||
private fun MutableSet<TypeParameterDescriptor>.addUsedTypeParameters(type: KotlinType) {
|
||||
val typeParameter = type.constructor.declarationDescriptor as? TypeParameterDescriptor
|
||||
if (typeParameter != null && add(typeParameter)) {
|
||||
typeParameter.lowerBounds.forEach { addUsedTypeParameters(it) }
|
||||
typeParameter.upperBounds.forEach { addUsedTypeParameters(it) }
|
||||
}
|
||||
|
||||
|
||||
-1
@@ -621,7 +621,6 @@ class KotlinPsiUnifier(
|
||||
desc2: TypeParameterDescriptor
|
||||
): Status {
|
||||
if (desc1.variance != desc2.variance) return UNMATCHED
|
||||
if (!matchTypes(desc1.lowerBounds, desc2.lowerBounds)) return UNMATCHED
|
||||
if (!matchTypes(desc1.upperBounds, desc2.upperBounds)) return UNMATCHED
|
||||
return MATCHED
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user