Skip to content

Commit

Permalink
Fix SQL Server operator precedence table
Browse files Browse the repository at this point in the history
Specifically, binary logical operators have the same precedence as `+`/`-`.

The table is now aligned with the referenced document, plus shift operators.
They seem to have the same precedence as `+`/`-` according to manual tests; no
documentation about this is available.

Fixes dotnet#30248.
  • Loading branch information
ranma42 committed Jun 2, 2024
1 parent 510243d commit 592a20d
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -649,16 +649,16 @@ protected override bool TryGetOperatorInfo(SqlExpression expression, out int pre
ExpressionType.Multiply => (900, true),
ExpressionType.Divide => (900, false),
ExpressionType.Modulo => (900, false),
ExpressionType.Add => (800, true),
ExpressionType.Subtract => (800, false),
ExpressionType.Add => (700, true),
ExpressionType.Subtract => (700, false),
ExpressionType.And => (700, true),
ExpressionType.Or => (700, true),
ExpressionType.LeftShift => (700, true),
ExpressionType.RightShift => (700, true),
ExpressionType.LessThan => (600, false),
ExpressionType.LessThanOrEqual => (600, false),
ExpressionType.GreaterThan => (600, false),
ExpressionType.GreaterThanOrEqual => (600, false),
ExpressionType.LessThan => (500, false),
ExpressionType.LessThanOrEqual => (500, false),
ExpressionType.GreaterThan => (500, false),
ExpressionType.GreaterThanOrEqual => (500, false),
ExpressionType.Equal => (500, false),
ExpressionType.NotEqual => (500, false),
ExpressionType.AndAlso => (200, true),
Expand Down

0 comments on commit 592a20d

Please sign in to comment.