Skip to content

Commit 3dbefd7

Browse files
author
José Valim
committed
Fix precedence of & in regards to =, closes #7188
1 parent fd1d15a commit 3dbefd7

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/elixir/lib/code/identifier.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ defmodule Code.Identifier do
1313
@spec unary_op(atom) :: {:non_associative, precedence :: pos_integer} | :error
1414
def unary_op(op) do
1515
cond do
16-
op in [:&] -> {:non_associative, 100}
16+
op in [:&] -> {:non_associative, 90}
1717
op in [:!, :^, :not, :+, :-, :~~~] -> {:non_associative, 300}
1818
op in [:@] -> {:non_associative, 320}
1919
true -> :error
@@ -36,7 +36,7 @@ defmodule Code.Identifier do
3636
op in [:when] -> {:right, 50}
3737
op in [:::] -> {:right, 60}
3838
op in [:|] -> {:right, 70}
39-
op in [:=] -> {:right, 90}
39+
op in [:=] -> {:right, 100}
4040
op in [:||, :|||, :or] -> {:left, 130}
4141
op in [:&&, :&&&, :and] -> {:left, 140}
4242
op in [:==, :!=, :=~, :===, :!==] -> {:left, 150}

lib/elixir/src/elixir_parser.yrl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ Right 50 when_op_eol. %% when
5959
Right 60 type_op_eol. %% ::
6060
Right 70 pipe_op_eol. %% |
6161
Right 80 assoc_op_eol. %% =>
62-
Right 90 match_op_eol. %% =
63-
Nonassoc 100 capture_op_eol. %% &
62+
Nonassoc 90 capture_op_eol. %% &
63+
Right 100 match_op_eol. %% =
6464
Left 130 or_op_eol. %% ||, |||, or
6565
Left 140 and_op_eol. %% &&, &&&, and
6666
Left 150 comp_op_eol. %% ==, !=, =~, ===, !==

0 commit comments

Comments
 (0)