diff options
author | LemonBoy <LemonBoy@users.noreply.github.com> | 2018-10-09 15:51:49 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-10-09 15:51:49 +0200 |
commit | 8a1055adcea8847e1cb2fae87c84d06afa3198b1 (patch) | |
tree | d86a9652d323aa0e0039c07f1e96cfcfb979a150 /tests | |
parent | dad290accbd547cbbe0b83592c115b09ed2624f8 (diff) | |
download | Nim-8a1055adcea8847e1cb2fae87c84d06afa3198b1.tar.gz |
Fix range type construction in the VM (#9205)
The `range[X,Y]` representation is wrong, we use `range[X .. Y]` instead. Fixes #9194
Diffstat (limited to 'tests')
-rw-r--r-- | tests/macros/t9194.nim | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/macros/t9194.nim b/tests/macros/t9194.nim new file mode 100644 index 000000000..ef58750aa --- /dev/null +++ b/tests/macros/t9194.nim @@ -0,0 +1,20 @@ +discard """ + output: ''' +range[0 .. 100] +array[0 .. 100, int] +''' +""" + +import macros + +type + Foo1 = range[0 .. 100] + Foo2 = array[0 .. 100, int] + +macro get(T: typedesc): untyped = + # Get the X out of typedesc[X] + let tmp = getTypeImpl(T) + result = newStrLitNode(getTypeImpl(tmp[1]).repr) + +echo Foo1.get +echo Foo2.get |