diff options
author | Araq <rumpf_a@web.de> | 2011-01-10 21:28:48 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2011-01-10 21:28:48 +0100 |
commit | 19fbc8a55edb009e216ab8954fde906dec6b738a (patch) | |
tree | f6796114c5053c39ffa9a785a5b1682c4d903c6f /tests/accept/run | |
parent | ceb1f5e218075196cd3b7d40973249e419db8ebf (diff) | |
download | Nim-19fbc8a55edb009e216ab8954fde906dec6b738a.tar.gz |
SPEC change: ^ is right-assoc and of highest priority
Diffstat (limited to 'tests/accept/run')
-rwxr-xr-x | tests/accept/run/spec.csv | 1 | ||||
-rw-r--r-- | tests/accept/run/toprprec.nim | 12 |
2 files changed, 13 insertions, 0 deletions
diff --git a/tests/accept/run/spec.csv b/tests/accept/run/spec.csv index 075e4e67e..980301bd0 100755 --- a/tests/accept/run/spec.csv +++ b/tests/accept/run/spec.csv @@ -49,6 +49,7 @@ tnestprc.nim;10 toop1.nim;34[]o 5 topenarrayrepr.nim;5 - [1] topenlen.nim;7 +toprprec.nim;done toverflw.nim;the computation overflowed toverflw2.nim;Error: unhandled exception: over- or underflow [EOverflow] toverl2.nim;true012 diff --git a/tests/accept/run/toprprec.nim b/tests/accept/run/toprprec.nim new file mode 100644 index 000000000..4728b2e68 --- /dev/null +++ b/tests/accept/run/toprprec.nim @@ -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" + |