summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorLemonBoy <LemonBoy@users.noreply.github.com>2018-10-09 15:51:49 +0200
committerAndreas Rumpf <rumpf_a@web.de>2018-10-09 15:51:49 +0200
commit8a1055adcea8847e1cb2fae87c84d06afa3198b1 (patch)
treed86a9652d323aa0e0039c07f1e96cfcfb979a150 /tests
parentdad290accbd547cbbe0b83592c115b09ed2624f8 (diff)
downloadNim-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.nim20
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