diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2021-09-03 17:31:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-03 17:31:16 +0200 |
commit | c2b20516d33520b1d339b447ece32ade8625fefc (patch) | |
tree | 91d937a20d7701e3c823fae5c40f091dbb77d21f /tests/lexer | |
parent | 905fae51f6ecfcde04276db669eb9a4f6481fc31 (diff) | |
download | Nim-c2b20516d33520b1d339b447ece32ade8625fefc.tar.gz |
implemented Unicode operators (#18789)
* implemented Unicode operators; refs https://github.com/nim-lang/RFCs/issues/388 * bugfix * better test * arguably more elegant implementation * Update changelog.md Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com> Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
Diffstat (limited to 'tests/lexer')
-rw-r--r-- | tests/lexer/nim.cfg | 1 | ||||
-rw-r--r-- | tests/lexer/tunicode_operators.nim | 14 |
2 files changed, 15 insertions, 0 deletions
diff --git a/tests/lexer/nim.cfg b/tests/lexer/nim.cfg new file mode 100644 index 000000000..f7a301a10 --- /dev/null +++ b/tests/lexer/nim.cfg @@ -0,0 +1 @@ +--experimental:unicodeOperators diff --git a/tests/lexer/tunicode_operators.nim b/tests/lexer/tunicode_operators.nim new file mode 100644 index 000000000..74fcbb763 --- /dev/null +++ b/tests/lexer/tunicode_operators.nim @@ -0,0 +1,14 @@ +#{.experimental: "unicodeOperators".} + +proc `⊙`(x, y: int): int = x * y +proc `⊙=`(x: var int, y: int) = x *= y + +proc `⊞++`(x, y: int): int = x + y + +var x = 45 +x ⊙= 9 ⊞++ 4 ⊙ 3 + +var y = 45 +y *= 9 + 4 * 3 + +assert x == y |