[FIR] Support determining emptiness of an intersection type with type parameters' types
This commit is contained in:
committed by
teamcity
parent
313da6f41e
commit
47d6236a2d
+11
-5
@@ -460,11 +460,6 @@ interface ClassicTypeSystemContext : TypeSystemInferenceExtensionContext, TypeSy
|
||||
return makeSimpleTypeDefinitelyNotNullOrNotNullInternal(this)
|
||||
}
|
||||
|
||||
override fun KotlinTypeMarker.isFinal(): Boolean {
|
||||
require(this is KotlinType, this::errorMessage)
|
||||
return !TypeUtils.canHaveSubtypes(KotlinTypeChecker.DEFAULT, this)
|
||||
}
|
||||
|
||||
override fun KotlinTypeMarker.removeAnnotations(): KotlinTypeMarker {
|
||||
require(this is UnwrappedType, this::errorMessage)
|
||||
return this.replaceAnnotations(Annotations.EMPTY)
|
||||
@@ -714,6 +709,17 @@ interface ClassicTypeSystemContext : TypeSystemInferenceExtensionContext, TypeSy
|
||||
return this is NewCapturedTypeConstructor
|
||||
}
|
||||
|
||||
override fun KotlinTypeMarker.eraseContainingTypeParameters(): KotlinTypeMarker {
|
||||
val eraser = TypeParameterUpperBoundEraser(
|
||||
ErasureProjectionComputer(),
|
||||
TypeParameterErasureOptions(leaveNonTypeParameterTypes = true, intersectUpperBounds = true)
|
||||
)
|
||||
val typeParameters = this.extractTypeParameters()
|
||||
.map { it as TypeParameterDescriptor }
|
||||
.associateWith { TypeProjectionImpl(eraser.getErasedUpperBound(it, ErasureTypeAttributes(TypeUsage.COMMON))) }
|
||||
return TypeConstructorSubstitution.createByParametersMap(typeParameters).buildSubstitutor().safeSubstitute(this)
|
||||
}
|
||||
|
||||
override fun TypeConstructorMarker.isTypeParameterTypeConstructor(): Boolean {
|
||||
return this is ClassifierBasedTypeConstructor && this.declarationDescriptor is AbstractTypeParameterDescriptor
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user