[FE 1.0] Don't throw empty intersection exception, return empty intersection type instead

This commit is contained in:
Victor Petukhov
2022-07-01 14:01:09 +02:00
committed by teamcity
parent a798fe0b18
commit 5b5da025f4
7 changed files with 91 additions and 1 deletions
@@ -29,6 +29,7 @@ import org.jetbrains.kotlin.resolve.calls.inference.ConstraintSystemBuilderImpl;
import org.jetbrains.kotlin.types.checker.KotlinTypeChecker;
import org.jetbrains.kotlin.types.error.ErrorTypeKind;
import org.jetbrains.kotlin.types.error.ErrorUtils;
import org.jetbrains.kotlin.types.typeUtil.TypeUtilsKt;
import java.util.*;
@@ -124,7 +125,7 @@ public class TypeIntersector {
}
if (bestRepresentative == null) {
throw new AssertionError("Empty intersection for types " + types);
return null;
}
return TypeUtils.makeNullableAsSpecified(bestRepresentative, allNullable);
}