diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2015-04-15 19:24:44 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2015-04-15 19:24:44 +0200 |
commit | b4e938ca21ba5ddadb749da21f9d55db99dc9d9c (patch) | |
tree | c1592d1ddc9ea873eaa26142370c4c55a3ac188f /tests | |
parent | 86b37f7fc7bd3e00c1d7ac481bf7b2405667869c (diff) | |
parent | 06617bbb76d4b9ecc0c40072ca472c4b3428514a (diff) | |
download | Nim-b4e938ca21ba5ddadb749da21f9d55db99dc9d9c.tar.gz |
Merge pull request #2503 from ReneSac/arrowLike
Restrict arrow-like operators to those ending with `->`, `~>` or `=>`
Diffstat (limited to 'tests')
-rw-r--r-- | tests/parser/tstrongspaces.nim | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/parser/tstrongspaces.nim b/tests/parser/tstrongspaces.nim index 568abda4c..e70b91988 100644 --- a/tests/parser/tstrongspaces.nim +++ b/tests/parser/tstrongspaces.nim @@ -15,6 +15,10 @@ true tester args all all args +19 +-3 +false +-2 ''' """ @@ -67,3 +71,13 @@ const echo tester & " " & args|"all" echo "all" | tester & " " & args echo "all"|tester & " " & args + +# Test arrow like operators. See also tests/macros/tclosuremacro.nim +proc `+->`(a, b: int): int = a + b*4 +template `===>`(a, b: int): expr = a - b shr 1 + +echo 3 +-> 2 + 2 and 4 +var arrowed = 3+->2 + 2 and 4 # arrowed = 4 +echo arrowed ===> 15 +echo (2 * 3+->2) == (2*3 +-> 2) +echo arrowed ===> 2 + 3+->2 |