From bf3a3caee619b2fcf0091b47ea6a4d370eb620c6 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Fri, 11 Feb 2022 23:04:53 +0300 Subject: [PATCH] FIR. Do not re-resolve parts of intersection types --- .../providers/impl/FirTypeResolverImpl.kt | 22 +++---------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/providers/impl/FirTypeResolverImpl.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/providers/impl/FirTypeResolverImpl.kt index 9f1dc38233d..faf33dcf0c7 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/providers/impl/FirTypeResolverImpl.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/providers/impl/FirTypeResolverImpl.kt @@ -486,27 +486,11 @@ class FirTypeResolverImpl(private val session: FirSession) : FirTypeResolver() { is FirFunctionTypeRef -> createFunctionalType(typeRef) to null is FirDynamicTypeRef -> ConeErrorType(ConeUnsupportedDynamicType()) to null is FirIntersectionTypeRef -> { - val (leftType, leftDiagnostic) = resolveType( - typeRef.leftType - ?: return ConeErrorType(ConeSimpleDiagnostic("Problem during processing intersection type")) to null, - scopeClassDeclaration, - areBareTypesAllowed, - isOperandOfIsOperator, - useSiteFile, - supertypeSupplier - ) - val (rightType, _) = resolveType( - typeRef.rightType - ?: return ConeErrorType(ConeSimpleDiagnostic("Problem during processing intersection type")) to null, - scopeClassDeclaration, - areBareTypesAllowed, - isOperandOfIsOperator, - useSiteFile, - supertypeSupplier - ) + val leftType = typeRef.leftType.coneType + val rightType = typeRef.rightType.coneType if (rightType.isAny && leftType is ConeTypeParameterType) { - ConeDefinitelyNotNullType(leftType) to leftDiagnostic //how properly concat (leftDiagnostic + rightDiagnostic)? + ConeDefinitelyNotNullType(leftType) to null } else { ConeErrorType(ConeUnsupported("Intersection types are not supported yet", typeRef.source)) to null }