Skip to content

Commit eb3a1b3

Browse files
committed
[CSDiag] NFC: Remove obsolete explicit closure result mismatch handling
1 parent 431ca98 commit eb3a1b3

File tree

1 file changed

+0
-29
lines changed

1 file changed

+0
-29
lines changed

lib/Sema/CSDiag.cpp

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -3243,35 +3243,6 @@ bool FailureDiagnosis::diagnoseClosureExpr(
32433243
return true;
32443244
}
32453245

3246-
// If the body of the closure looked ok, then look for a contextual type
3247-
// error. This is necessary because FailureDiagnosis::diagnoseExprFailure
3248-
// doesn't do this for closures.
3249-
if (contextualType) {
3250-
auto fnType = contextualType->getAs<AnyFunctionType>();
3251-
if (!fnType || fnType->isEqual(CS.getType(CE)))
3252-
return false;
3253-
3254-
auto contextualResultType = fnType->getResult();
3255-
// If the result type was unknown, it doesn't really make
3256-
// sense to diagnose from expected to unknown here.
3257-
if (isInvalidClosureResultType(contextualResultType))
3258-
return false;
3259-
3260-
// If the closure had an explicitly written return type incompatible with
3261-
// the contextual type, diagnose that.
3262-
if (CE->hasExplicitResultType() &&
3263-
CE->getExplicitResultTypeLoc().getTypeRepr()) {
3264-
auto explicitResultTy = CE->getExplicitResultTypeLoc().getType();
3265-
if (fnType && !explicitResultTy->isEqual(contextualResultType)) {
3266-
auto repr = CE->getExplicitResultTypeLoc().getTypeRepr();
3267-
diagnose(repr->getStartLoc(), diag::incorrect_explicit_closure_result,
3268-
explicitResultTy, fnType->getResult())
3269-
.fixItReplace(repr->getSourceRange(),fnType->getResult().getString());
3270-
return true;
3271-
}
3272-
}
3273-
}
3274-
32753246
// Otherwise, we can't produce a specific diagnostic.
32763247
return false;
32773248
}

0 commit comments

Comments
 (0)