[FE] Don't check intersection emptiness if there were lower constraints

This commit is contained in:
Victor Petukhov
2022-04-27 10:30:09 +03:00
committed by teamcity
parent d4d45a8410
commit 73be9d0a20
5 changed files with 14 additions and 13 deletions
@@ -892,7 +892,11 @@ internal object CheckIncompatibleTypeVariableUpperBounds : ResolutionPart() {
for (variableWithConstraints in getSystem().getBuilder().currentStorage().notFixedTypeVariables.values) {
val upperTypes = variableWithConstraints.constraints.extractUpperTypesToCheckIntersectionEmptiness()
if (upperTypes.computeEmptyIntersectionTypeKind().isDefinitelyEmpty()) {
// TODO: consider reporting errors on bounded type variables by incompatible types but with other lower constraints
if (
variableWithConstraints.constraints.none { it.kind.isLower() }
&& upperTypes.computeEmptyIntersectionTypeKind().isDefinitelyEmpty()
) {
val isInferredEmptyIntersectionForbidden =
callComponents.languageVersionSettings.supportsFeature(LanguageFeature.ForbidInferringTypeVariablesIntoEmptyIntersection)