Minor. Removed TypeParameterDescriptor#getLowerBounds
This commit is contained in:
+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) {
|
||||
|
||||
Reference in New Issue
Block a user