Skip to content

Commit 689a57b

Browse files
committed
[CSDiag] Remove some dead code for diagnosing ambiguity from CSDiag.
1 parent 74f65ba commit 689a57b

File tree

1 file changed

+0
-51
lines changed

1 file changed

+0
-51
lines changed

lib/Sema/CSDiag.cpp

-51
Original file line numberDiff line numberDiff line change
@@ -1494,41 +1494,6 @@ bool FailureDiagnosis::visitApplyExpr(ApplyExpr *callExpr) {
14941494
AnyFunctionType::decomposeInput(CS.getType(argExpr), params);
14951495
auto argString = AnyFunctionType::getParamListAsString(params);
14961496

1497-
// If we couldn't get the name of the callee, then it must be something of a
1498-
// more complex "value of function type".
1499-
if (overloadName.empty()) {
1500-
// If we couldn't infer the result type of the closure expr, then we have
1501-
// some sort of ambiguity, let the ambiguity diagnostic stuff handle this.
1502-
if (auto ffty = fnType->getAs<AnyFunctionType>())
1503-
if (ffty->getResult()->hasTypeVariable()) {
1504-
diagnoseAmbiguity(fnExpr);
1505-
return true;
1506-
}
1507-
1508-
// The most common unnamed value of closure type is a ClosureExpr, so
1509-
// special case it.
1510-
if (isa<ClosureExpr>(fnExpr->getValueProvidingExpr())) {
1511-
if (fnType->hasTypeVariable())
1512-
diagnose(argExpr->getStartLoc(), diag::cannot_invoke_closure, argString)
1513-
.highlight(fnExpr->getSourceRange());
1514-
else
1515-
diagnose(argExpr->getStartLoc(), diag::cannot_invoke_closure_type,
1516-
fnType, argString)
1517-
.highlight(fnExpr->getSourceRange());
1518-
1519-
} else if (fnType->hasTypeVariable()) {
1520-
diagnose(argExpr->getStartLoc(), diag::cannot_call_function_value,
1521-
argString)
1522-
.highlight(fnExpr->getSourceRange());
1523-
} else {
1524-
diagnose(argExpr->getStartLoc(), diag::cannot_call_value_of_function_type,
1525-
fnType, argString)
1526-
.highlight(fnExpr->getSourceRange());
1527-
}
1528-
1529-
return true;
1530-
}
1531-
15321497
if (auto MTT = fnType->getAs<MetatypeType>()) {
15331498
if (MTT->getInstanceType()->isExistentialType()) {
15341499
diagnose(fnExpr->getLoc(), diag::construct_protocol_value, fnType);
@@ -1755,22 +1720,6 @@ void FailureDiagnosis::diagnoseAmbiguity(Expr *E) {
17551720
}
17561721
}
17571722

1758-
// Diagnose empty collection literals that lack context specifically.
1759-
if (auto CE = dyn_cast<CollectionExpr>(E->getSemanticsProvidingExpr())) {
1760-
if (CE->getNumElements() == 0) {
1761-
diagnose(E->getLoc(), diag::unresolved_collection_literal)
1762-
.highlight(E->getSourceRange());
1763-
return;
1764-
}
1765-
}
1766-
1767-
// Diagnose 'nil' without a contextual type.
1768-
if (isa<NilLiteralExpr>(E->getSemanticsProvidingExpr())) {
1769-
diagnose(E->getLoc(), diag::unresolved_nil_literal)
1770-
.highlight(E->getSourceRange());
1771-
return;
1772-
}
1773-
17741723
// Attempt to re-type-check the entire expression, allowing ambiguity, but
17751724
// ignoring a contextual type.
17761725
if (expr == E) {

0 commit comments

Comments
 (0)