[FE] Erase type parameters of super types during intersection type emptiness check as well

This commit is contained in:
Victor Petukhov
2022-04-25 12:25:06 +03:00
committed by teamcity
parent 0f1d212fc5
commit fb76d819f0
19 changed files with 106 additions and 167 deletions
@@ -359,8 +359,13 @@ interface TypeSystemInferenceExtensionContext : TypeSystemContext, TypeSystemBui
// B & C can't have common subtype due to having incompatible supertypes: A<String> and A<Int>
val haveIncompatibleSupertypes = firstType.anySuperTypeConstructor { superTypeOfFirst ->
secondType.anySuperTypeConstructor { superTypeOfSecond ->
val erasedSuperTypeOfSecond by lazy { superTypeOfSecond.eraseContainingTypeParameters() }
superTypeOfFirst.typeConstructor() == superTypeOfSecond.typeConstructor()
&& !AbstractTypeChecker.equalTypes(this, superTypeOfFirst, superTypeOfSecond)
&& !AbstractTypeChecker.equalTypes(
context = this,
superTypeOfFirst.eraseContainingTypeParameters(),
erasedSuperTypeOfSecond
)
}
}