Merge pull request #61066 from LucianoPAlmeida/diagnose-operator-crash

[Sema] Add param indicate diagnose or not in lookupPrecedenceGroupForInfixOperator
This commit is contained in:
Pavel Yaskevich
2022-09-14 15:33:10 -07:00
committed by GitHub
4 changed files with 50 additions and 23 deletions

View File

@@ -8116,7 +8116,8 @@ bool swift::exprNeedsParensInsideFollowingOperator(
DeclContext *DC, Expr *expr,
PrecedenceGroupDecl *followingPG) {
if (expr->isInfixOperator()) {
auto exprPG = TypeChecker::lookupPrecedenceGroupForInfixOperator(DC, expr);
auto exprPG = TypeChecker::lookupPrecedenceGroupForInfixOperator(
DC, expr, /*diagnose=*/false);
if (!exprPG) return true;
return DC->getASTContext().associateInfixOperators(exprPG, followingPG)
@@ -8166,8 +8167,8 @@ bool swift::exprNeedsParensOutsideFollowingOperator(
return false;
if (parent->isInfixOperator()) {
auto parentPG = TypeChecker::lookupPrecedenceGroupForInfixOperator(DC,
parent);
auto parentPG = TypeChecker::lookupPrecedenceGroupForInfixOperator(
DC, parent, /*diagnose=*/false);
if (!parentPG) return true;
// If the index is 0, this is on the LHS of the parent.