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