[FE] Support intersection type emptiness checking for interfaces

This commit is contained in:
Victor Petukhov
2022-04-21 13:31:56 +03:00
committed by teamcity
parent 1da52ab197
commit 39d13442be
29 changed files with 614 additions and 42 deletions
@@ -19,6 +19,7 @@ import org.jetbrains.kotlin.fir.symbols.ConeTypeParameterLookupTag
import org.jetbrains.kotlin.fir.types.impl.ConeClassLikeTypeImpl
import org.jetbrains.kotlin.fir.types.impl.ConeTypeParameterTypeImpl
import org.jetbrains.kotlin.name.StandardClassIds
import org.jetbrains.kotlin.resolve.calls.NewCommonSuperTypeCalculator.commonSuperType
import org.jetbrains.kotlin.types.AbstractTypeChecker
import org.jetbrains.kotlin.types.AbstractTypeRefiner
import org.jetbrains.kotlin.types.TypeCheckerState
@@ -502,8 +503,8 @@ interface ConeInferenceContext : TypeSystemInferenceExtensionContext, ConeTypeCo
this
else {
var functionalSupertype: KotlinTypeMarker? = null
simpleType.anySuperTypeConstructor { typeConstructor ->
simpleType.fastCorrespondingSupertypes(typeConstructor)?.any { superType ->
simpleType.anySuperTypeConstructor { type ->
simpleType.fastCorrespondingSupertypes(type.typeConstructor())?.any { superType ->
val isFunctional = superType.cast<ConeKotlinType>().isBuiltinFunctionalType(session)
if (isFunctional)
functionalSupertype = superType