[FIR] Support intersection types in some type context methods
This commit is contained in:
+5
-13
@@ -134,10 +134,10 @@ interface ConeInferenceContext : TypeSystemInferenceExtensionContext, ConeTypeCo
|
||||
|
||||
if (predicate(this)) return true
|
||||
|
||||
val flexibleType = this.asFlexibleType()
|
||||
val flexibleType = this as? ConeFlexibleType
|
||||
if (flexibleType != null
|
||||
&& (flexibleType.lowerBound().containsInternal(predicate, visited)
|
||||
|| flexibleType.upperBound().containsInternal(predicate, visited))
|
||||
&& (flexibleType.lowerBound.containsInternal(predicate, visited)
|
||||
|| flexibleType.upperBound.containsInternal(predicate, visited))
|
||||
) {
|
||||
return true
|
||||
}
|
||||
@@ -148,18 +148,10 @@ interface ConeInferenceContext : TypeSystemInferenceExtensionContext, ConeTypeCo
|
||||
) {
|
||||
return true
|
||||
}
|
||||
/*
|
||||
TODO:
|
||||
|
||||
TypeConstructor typeConstructor = type.getConstructor();
|
||||
if (typeConstructor instanceof IntersectionTypeConstructor) {
|
||||
IntersectionTypeConstructor intersectionTypeConstructor = (IntersectionTypeConstructor) typeConstructor;
|
||||
for (KotlinType supertype : intersectionTypeConstructor.getSupertypes()) {
|
||||
if (contains(supertype, isSpecialType, visited)) return true;
|
||||
}
|
||||
return false;
|
||||
if (this is ConeIntersectionType) {
|
||||
return this.intersectedTypes.any { it.containsInternal(predicate, visited) }
|
||||
}
|
||||
*/
|
||||
|
||||
repeat(argumentsCount()) { index ->
|
||||
val argument = getArgument(index)
|
||||
|
||||
@@ -417,7 +417,10 @@ interface ConeTypeContext : TypeSystemContext, TypeSystemOptimizationContext, Ty
|
||||
if (this is ConeTypeParameterType /* || is TypeVariable */)
|
||||
return hasNullableSuperType(type)
|
||||
|
||||
// TODO: Intersection types
|
||||
if (this is ConeIntersectionType && intersectedTypes.any { it.isNullableType() }) {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user