EmptyIntersectionTypeChecker: make some names more clear

This commit is contained in:
Mikhail Glukhikh
2022-11-24 17:27:03 +01:00
committed by Space Team
parent e9ea66b9f1
commit caf511acc5
@@ -91,17 +91,17 @@ internal object EmptyIntersectionTypeChecker {
return EmptyIntersectionTypeInfo(EmptyIntersectionTypeKind.MULTIPLE_CLASSES, firstType, secondType) return EmptyIntersectionTypeInfo(EmptyIntersectionTypeKind.MULTIPLE_CLASSES, firstType, secondType)
} }
val superTypeByFirstConstructor = AbstractTypeChecker.findCorrespondingSupertypes( val firstSuperTypeWithSecondConstructor = AbstractTypeChecker.findCorrespondingSupertypes(
typeCheckerState, firstType.lowerBoundIfFlexible(), secondTypeConstructor typeCheckerState, firstType.lowerBoundIfFlexible(), secondTypeConstructor
).singleOrNull() ).singleOrNull()
val superTypeBySecondConstructor = AbstractTypeChecker.findCorrespondingSupertypes( val secondSuperTypeByFirstConstructor = AbstractTypeChecker.findCorrespondingSupertypes(
typeCheckerState, secondType.lowerBoundIfFlexible(), firstTypeConstructor typeCheckerState, secondType.lowerBoundIfFlexible(), firstTypeConstructor
).singleOrNull() ).singleOrNull()
val atLeastOneInterface = firstTypeConstructor.isInterface() || secondTypeConstructor.isInterface() val atLeastOneInterface = firstTypeConstructor.isInterface() || secondTypeConstructor.isInterface()
// Two classes can't have a common subtype if neither is a subtype of another // Two classes can't have a common subtype if neither is a subtype of another
if (superTypeByFirstConstructor == null && superTypeBySecondConstructor == null && !atLeastOneInterface) if (firstSuperTypeWithSecondConstructor == null && secondSuperTypeByFirstConstructor == null && !atLeastOneInterface)
return EmptyIntersectionTypeInfo(EmptyIntersectionTypeKind.MULTIPLE_CLASSES, firstType, secondType) return EmptyIntersectionTypeInfo(EmptyIntersectionTypeKind.MULTIPLE_CLASSES, firstType, secondType)
if (atLeastOneInterface) { if (atLeastOneInterface) {
@@ -111,7 +111,7 @@ internal object EmptyIntersectionTypeChecker {
} }
} }
if (superTypeByFirstConstructor == null || superTypeBySecondConstructor == null) { if (firstSuperTypeWithSecondConstructor == null || secondSuperTypeByFirstConstructor == null) {
// don't have incompatible supertypes so can have a common subtype only if all types are interfaces // don't have incompatible supertypes so can have a common subtype only if all types are interfaces
if (firstTypeConstructor.isFinalClassConstructor() || secondTypeConstructor.isFinalClassConstructor()) { if (firstTypeConstructor.isFinalClassConstructor() || secondTypeConstructor.isFinalClassConstructor()) {
possibleEmptyIntersectionKind = possibleEmptyIntersectionKind =
@@ -121,7 +121,7 @@ internal object EmptyIntersectionTypeChecker {
} }
val argumentsIntersectionKind = val argumentsIntersectionKind =
computeByCheckingTypeArguments(superTypeByFirstConstructor, superTypeBySecondConstructor) ?: continue computeByCheckingTypeArguments(firstSuperTypeWithSecondConstructor, secondSuperTypeByFirstConstructor) ?: continue
if (argumentsIntersectionKind.kind.isDefinitelyEmpty()) if (argumentsIntersectionKind.kind.isDefinitelyEmpty())
return argumentsIntersectionKind return argumentsIntersectionKind