@@ -1447,29 +1447,6 @@ bool FailureDiagnosis::visitApplyExpr(ApplyExpr *callExpr) {
1447
1447
auto lhsType = CS.getType (lhsExpr)->getRValueType ();
1448
1448
auto rhsType = CS.getType (rhsExpr)->getRValueType ();
1449
1449
1450
- // TODO(diagnostics): There are still cases not yet handled by new
1451
- // diagnostics framework e.g.
1452
- //
1453
- // var tuple = (1, 2, 3)
1454
- // switch tuple {
1455
- // case (let (_, _, _)) + 1: break
1456
- // }
1457
- if (callExpr->isImplicit () && overloadName == " ~=" ) {
1458
- auto flags = ParameterTypeFlags ();
1459
- if (calleeInfo.candidates .size () == 1 )
1460
- if (auto fnType = calleeInfo.candidates [0 ].getFunctionType ())
1461
- flags = fnType->getParams ()[0 ].getParameterFlags ();
1462
-
1463
- auto *locator = CS.getConstraintLocator (
1464
- callExpr,
1465
- {ConstraintLocator::ApplyArgument,
1466
- LocatorPathElt::ApplyArgToParam (0 , 0 , flags)},
1467
- /* summaryFlags=*/ 0 );
1468
-
1469
- ArgumentMismatchFailure failure (CS, lhsType, rhsType, locator);
1470
- return failure.diagnosePatternMatchingMismatch ();
1471
- }
1472
-
1473
1450
if (isContextualConversionFailure (argTuple))
1474
1451
return false ;
1475
1452
@@ -1754,22 +1731,6 @@ void FailureDiagnosis::diagnoseAmbiguity(Expr *E) {
1754
1731
if (auto *assignment = dyn_cast<AssignExpr>(E)) {
1755
1732
if (isa<DiscardAssignmentExpr>(assignment->getDest ())) {
1756
1733
auto *srcExpr = assignment->getSrc ();
1757
-
1758
- bool diagnosedInvalidUseOfDiscardExpr = false ;
1759
- srcExpr->forEachChildExpr ([&](Expr *expr) -> Expr * {
1760
- if (auto *DAE = dyn_cast<DiscardAssignmentExpr>(expr)) {
1761
- diagnose (DAE->getLoc (), diag::discard_expr_outside_of_assignment)
1762
- .highlight (srcExpr->getSourceRange ());
1763
- diagnosedInvalidUseOfDiscardExpr = true ;
1764
- return nullptr ;
1765
- }
1766
-
1767
- return expr;
1768
- });
1769
-
1770
- if (diagnosedInvalidUseOfDiscardExpr)
1771
- return ;
1772
-
1773
1734
diagnoseAmbiguity (srcExpr);
1774
1735
return ;
1775
1736
}
@@ -1783,15 +1744,6 @@ void FailureDiagnosis::diagnoseAmbiguity(Expr *E) {
1783
1744
return ;
1784
1745
}
1785
1746
1786
- // A DiscardAssignmentExpr (spelled "_") needs contextual type information to
1787
- // infer its type. If we see one at top level, diagnose that it must be part
1788
- // of an assignment so we don't get a generic "expression is ambiguous" error.
1789
- if (isa<DiscardAssignmentExpr>(E)) {
1790
- diagnose (E->getLoc (), diag::discard_expr_outside_of_assignment)
1791
- .highlight (E->getSourceRange ());
1792
- return ;
1793
- }
1794
-
1795
1747
// Diagnose ".foo" expressions that lack context specifically.
1796
1748
if (auto UME =
1797
1749
dyn_cast<UnresolvedMemberExpr>(E->getSemanticsProvidingExpr ())) {
0 commit comments