Skip to content

Commit ba6d385

Browse files
committed
Sema: Remove some apparently-dead code from CSDiag
I noticed this while working on some other changes.
1 parent 50374f0 commit ba6d385

File tree

1 file changed

+5
-20
lines changed

1 file changed

+5
-20
lines changed

lib/Sema/CSDiag.cpp

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5451,11 +5451,9 @@ bool FailureDiagnosis::diagnoseCallContextualConversionErrors(
54515451
auto *DC = CS.DC;
54525452

54535453
auto typeCheckExpr = [](TypeChecker &TC, Expr *expr, DeclContext *DC,
5454-
SmallPtrSetImpl<TypeBase *> &types,
5455-
Type contextualType = Type()) {
5456-
CalleeListener listener(contextualType);
5454+
SmallPtrSetImpl<TypeBase *> &types) {
54575455
TC.getPossibleTypesOfExpressionWithoutApplying(
5458-
expr, DC, types, FreeTypeVariableBinding::Disallow, &listener);
5456+
expr, DC, types, FreeTypeVariableBinding::Disallow);
54595457
};
54605458

54615459
// First let's type-check expression without contextual type, and
@@ -5470,22 +5468,9 @@ bool FailureDiagnosis::diagnoseCallContextualConversionErrors(
54705468
if (withoutContextual.empty())
54715469
return false;
54725470

5473-
SmallPtrSet<TypeBase *, 4> withContextual;
5474-
typeCheckExpr(TC, callExpr, DC, withContextual, contextualType);
5475-
// If type-checking with contextual type didn't produce any results
5476-
// it means that we have a contextual mismatch.
5477-
if (withContextual.empty()) {
5478-
// If there is just a single choice, we can hit contextual diagnostics
5479-
// about it in case re-typecheck fails.
5480-
Type exprType = withoutContextual.size() == 1 ? *withoutContextual.begin() : Type();
5481-
return diagnoseContextualConversionError(callExpr, contextualType, CTP,
5482-
exprType);
5483-
}
5484-
5485-
// If call produces a single type when type-checked with contextual
5486-
// expression, it means that the problem is elsewhere, any other
5487-
// outcome is ambiguous.
5488-
return false;
5471+
Type exprType = withoutContextual.size() == 1 ? *withoutContextual.begin() : Type();
5472+
return diagnoseContextualConversionError(callExpr, contextualType, CTP,
5473+
exprType);
54895474
}
54905475

54915476
bool FailureDiagnosis::diagnoseSubscriptMisuse(ApplyExpr *callExpr) {

0 commit comments

Comments
 (0)