[FE] Cache checking intersection type emptiness results

This commit is contained in:
Victor Petukhov
2022-05-05 18:23:29 +02:00
committed by teamcity
parent 9a3b5e547b
commit e133ee3765
4 changed files with 27 additions and 8 deletions
@@ -889,7 +889,8 @@ internal object CheckIncompatibleTypeVariableUpperBounds : ResolutionPart() {
callComponents.statelessCallbacks.isOldIntersectionIsEmpty(upperTypes.cast())
override fun ResolutionCandidate.process(workIndex: Int) = with(getSystem().asConstraintSystemCompleterContext()) {
for (variableWithConstraints in getSystem().getBuilder().currentStorage().notFixedTypeVariables.values) {
val constraintSystem = getSystem()
for (variableWithConstraints in constraintSystem.getBuilder().currentStorage().notFixedTypeVariables.values) {
val upperTypes = variableWithConstraints.constraints.extractUpperTypesToCheckIntersectionEmptiness()
when {
@@ -900,7 +901,7 @@ internal object CheckIncompatibleTypeVariableUpperBounds : ResolutionPart() {
markCandidateForCompatibilityResolve(needToReportWarning = false)
continue
}
upperTypes.computeEmptyIntersectionTypeKind().isDefinitelyEmpty() -> {
constraintSystem.getEmptyIntersectionTypeKind(upperTypes).isDefinitelyEmpty() -> {
val isInferredEmptyIntersectionForbidden =
callComponents.languageVersionSettings.supportsFeature(LanguageFeature.ForbidInferringTypeVariablesIntoEmptyIntersection)