Skip to content

Commit 1be60a7

Browse files
committed
[ConstraintSystem] NFC: While diagnosing operator ambiguity use Identifier::is to compare names
1 parent 94b4052 commit 1be60a7

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/Sema/ConstraintSystem.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2583,10 +2583,10 @@ static void diagnoseOperatorAmbiguity(ConstraintSystem &cs,
25832583
if (!applyExpr)
25842584
return;
25852585

2586-
auto isNameOfStandardComparisonOperator = [](StringRef opName) -> bool {
2587-
return opName == "==" || opName == "!=" || opName == "===" ||
2588-
opName == "!==" || opName == "<" || opName == ">" ||
2589-
opName == "<=" || opName == ">=";
2586+
auto isNameOfStandardComparisonOperator = [](Identifier opName) -> bool {
2587+
return opName.is("==") || opName.is("!=") || opName.is("===") ||
2588+
opName.is("!==") || opName.is("<") || opName.is(">") ||
2589+
opName.is("<=") || opName.is(">=");
25902590
};
25912591

25922592
auto isEnumWithAssociatedValues = [](Type type) -> bool {
@@ -2609,7 +2609,7 @@ static void diagnoseOperatorAmbiguity(ConstraintSystem &cs,
26092609
.highlight(lhs->getSourceRange())
26102610
.highlight(rhs->getSourceRange());
26112611

2612-
if (isNameOfStandardComparisonOperator(operatorName.str()) &&
2612+
if (isNameOfStandardComparisonOperator(operatorName) &&
26132613
isEnumWithAssociatedValues(lhsType)) {
26142614
DE.diagnose(applyExpr->getLoc(),
26152615
diag::no_binary_op_overload_for_enum_with_payload,

0 commit comments

Comments
 (0)