[FIR] Support determining emptiness of an intersection type with type parameters' types
This commit is contained in:
committed by
teamcity
parent
313da6f41e
commit
47d6236a2d
@@ -41,6 +41,7 @@ import org.jetbrains.kotlin.resolve.calls.tower.CandidateApplicability
|
||||
import org.jetbrains.kotlin.resolve.deprecation.DeprecationLevelValue
|
||||
import org.jetbrains.kotlin.types.AbstractNullabilityChecker
|
||||
import org.jetbrains.kotlin.types.TypeApproximatorConfiguration
|
||||
import org.jetbrains.kotlin.types.isDefinitelyEmpty
|
||||
import org.jetbrains.kotlin.util.OperatorNameConventions
|
||||
|
||||
abstract class ResolutionStage {
|
||||
@@ -579,12 +580,12 @@ internal object CheckLowPriorityInOverloadResolution : CheckerStage() {
|
||||
internal object CheckIncompatibleTypeVariableUpperBounds : ResolutionStage() {
|
||||
override suspend fun check(candidate: Candidate, callInfo: CallInfo, sink: CheckerSink, context: ResolutionContext) =
|
||||
with(candidate.system.asConstraintSystemCompleterContext()) {
|
||||
val typeVariables = candidate.system.notFixedTypeVariables.values
|
||||
val typeVariables = candidate.system.notFixedTypeVariables.values.takeIf { it.isNotEmpty() } ?: return
|
||||
|
||||
for (variableWithConstraints in typeVariables) {
|
||||
val upperTypes = variableWithConstraints.constraints.extractUpperTypes()
|
||||
|
||||
if (upperTypes.isEmptyIntersection()) {
|
||||
if (upperTypes.computeEmptyIntersectionTypeKind().isDefinitelyEmpty()) {
|
||||
sink.yieldDiagnostic(
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
InferredEmptyIntersectionDiagnostic(
|
||||
|
||||
Reference in New Issue
Block a user