@@ -1494,41 +1494,6 @@ bool FailureDiagnosis::visitApplyExpr(ApplyExpr *callExpr) {
1494
1494
AnyFunctionType::decomposeInput (CS.getType (argExpr), params);
1495
1495
auto argString = AnyFunctionType::getParamListAsString (params);
1496
1496
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
-
1532
1497
if (auto MTT = fnType->getAs <MetatypeType>()) {
1533
1498
if (MTT->getInstanceType ()->isExistentialType ()) {
1534
1499
diagnose (fnExpr->getLoc (), diag::construct_protocol_value, fnType);
@@ -1755,22 +1720,6 @@ void FailureDiagnosis::diagnoseAmbiguity(Expr *E) {
1755
1720
}
1756
1721
}
1757
1722
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
-
1774
1723
// Attempt to re-type-check the entire expression, allowing ambiguity, but
1775
1724
// ignoring a contextual type.
1776
1725
if (expr == E) {
0 commit comments