From e67eb0c123779449563341914b42f877082c67cd Mon Sep 17 00:00:00 2001 From: Jinseong Jeon Date: Tue, 9 Feb 2021 23:59:36 -0800 Subject: [PATCH] FIR checker: typed declaration's return type should be resolved except for those in function contracts --- .../declaration/FirConflictingProjectionChecker.kt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirConflictingProjectionChecker.kt b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirConflictingProjectionChecker.kt index b82cb04fc20..92c716e42ed 100644 --- a/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirConflictingProjectionChecker.kt +++ b/compiler/fir/checkers/src/org/jetbrains/kotlin/fir/analysis/checkers/declaration/FirConflictingProjectionChecker.kt @@ -23,6 +23,10 @@ object FirConflictingProjectionChecker : FirBasicDeclarationChecker() { } if (declaration is FirTypedDeclaration) { + // The body of function contract is not fully resolved. + if (declaration.resolvePhase == FirResolvePhase.CONTRACTS) { + return + } checkTypeRef(declaration.returnTypeRef, context, reporter) } @@ -44,10 +48,7 @@ object FirConflictingProjectionChecker : FirBasicDeclarationChecker() { } private fun checkTypeRef(typeRef: FirTypeRef, context: CheckerContext, reporter: DiagnosticReporter) { - // TODO: remaining implicit types should be resolved as an error type, along with proper error kind, - // e.g., type mismatch, can't infer parameter type, syntax error, etc. - val declaration = typeRef.safeAs() - ?.coneTypeSafe() + val declaration = typeRef.coneTypeSafe() ?.lookupTag ?.toSymbol(context.session) ?.fir.safeAs()