FE: introduce AllowEmptyIntersectionsInResultTypeResolver feature
Related to KT-51221
This commit is contained in:
committed by
Space Team
parent
fbea09b3b6
commit
47fab61716
+3
-4
@@ -265,8 +265,9 @@ class ResultTypeResolver(
|
||||
}
|
||||
|
||||
private fun Context.computeUpperType(upperConstraints: List<Constraint>): KotlinTypeMarker {
|
||||
// TODO: Remove this after stopping support of K1
|
||||
return if (!isK2) {
|
||||
return if (languageVersionSettings.supportsFeature(LanguageFeature.AllowEmptyIntersectionsInResultTypeResolver)) {
|
||||
intersectTypes(upperConstraints.map { it.type })
|
||||
} else {
|
||||
val intersectionUpperType = intersectTypes(upperConstraints.map { it.type })
|
||||
val resultIsActuallyIntersection = intersectionUpperType.typeConstructor().isIntersection()
|
||||
|
||||
@@ -291,8 +292,6 @@ class ResultTypeResolver(
|
||||
if (filteredUpperConstraints.isNotEmpty()) intersectTypes(filteredUpperConstraints) else intersectionUpperType
|
||||
} else intersectionUpperType
|
||||
upperType
|
||||
} else {
|
||||
intersectTypes(upperConstraints.map { it.type })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user