[FIR] Return error type from common super type if it present
This commit is contained in:
+9
@@ -131,6 +131,7 @@ object NewCommonSuperTypeCalculator {
|
||||
|
||||
val explicitSupertypes = filterSupertypes(uniqueTypes)
|
||||
if (explicitSupertypes.size == 1) return explicitSupertypes.single()
|
||||
findErrorTypeInSupertypesIfItIsNeeded(explicitSupertypes)?.let { return it }
|
||||
|
||||
findCommonIntegerLiteralTypesSuperType(explicitSupertypes)?.let { return it }
|
||||
// IntegerLiteralTypeConstructor.findCommonSuperType(explicitSupertypes)?.let { return it }
|
||||
@@ -138,6 +139,14 @@ object NewCommonSuperTypeCalculator {
|
||||
return findSuperTypeConstructorsAndIntersectResult(explicitSupertypes, depth)
|
||||
}
|
||||
|
||||
private fun TypeSystemCommonSuperTypesContext.findErrorTypeInSupertypesIfItIsNeeded(types: List<SimpleTypeMarker>): SimpleTypeMarker? {
|
||||
if (isErrorTypeAllowed) return null
|
||||
for (type in types) {
|
||||
collectAllSupertypes(type).firstOrNull { it.isError() }?.let { return it.toErrorType() }
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
private fun TypeSystemCommonSuperTypesContext.findSuperTypeConstructorsAndIntersectResult(
|
||||
types: List<SimpleTypeMarker>,
|
||||
depth: Int
|
||||
|
||||
Reference in New Issue
Block a user