Skip to content

Commit 73667cd

Browse files
committed
[Diagnostics] Use Id_MatchOperator to check whether given operator is pattern match
1 parent c0840fd commit 73667cd

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lib/Sema/CSFix.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ bool ContextualMismatch::diagnoseForAmbiguity(
273273
etalonTypes.second->isEqual(types.second);
274274
})) {
275275
const auto &primary = commonFixes.front();
276-
return primary.second->diagnose(*primary.first, /*aNote=*/false);
276+
return primary.second->diagnose(*primary.first, /*asNote=*/false);
277277
}
278278

279279
return false;

lib/Sema/ConstraintSystem.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2775,7 +2775,8 @@ static void diagnoseOperatorAmbiguity(ConstraintSystem &cs,
27752775
Identifier operatorName,
27762776
ArrayRef<Solution> solutions,
27772777
ConstraintLocator *locator) {
2778-
auto &DE = cs.getASTContext().Diags;
2778+
auto &ctx = cs.getASTContext();
2779+
auto &DE = ctx.Diags;
27792780
auto *anchor = castToExpr(locator->getAnchor());
27802781
auto *applyExpr = cast<ApplyExpr>(cs.getParentExpr(anchor));
27812782

@@ -2814,7 +2815,7 @@ static void diagnoseOperatorAmbiguity(ConstraintSystem &cs,
28142815
operatorName.str());
28152816
return;
28162817
}
2817-
} else if (operatorName.is("~=")) {
2818+
} else if (operatorName == ctx.Id_MatchOperator) {
28182819
DE.diagnose(anchor->getLoc(), diag::cannot_match_expr_pattern_with_value,
28192820
lhsType, rhsType);
28202821
} else {

0 commit comments

Comments
 (0)