SPEC change: ^ is right-assoc and of highest priority
This commit is contained in:
parent
ceb1f5e218
commit
19fbc8a55e
4 changed files with 38 additions and 26 deletions
12
tests/accept/run/toprprec.nim
Normal file
12
tests/accept/run/toprprec.nim
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
# Test operator precedence:
|
||||
|
||||
assert 3+5*5-2 == 28- -26-28
|
||||
|
||||
proc `^-` (x, y: int): int =
|
||||
# now right-associative!
|
||||
result = x - y
|
||||
|
||||
assert 34 ^- 6 ^- 2 == 30
|
||||
assert 34 - 6 - 2 == 26
|
||||
echo "done"
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue