From 8a1055adcea8847e1cb2fae87c84d06afa3198b1 Mon Sep 17 00:00:00 2001 From: LemonBoy Date: Tue, 9 Oct 2018 15:51:49 +0200 Subject: Fix range type construction in the VM (#9205) The `range[X,Y]` representation is wrong, we use `range[X .. Y]` instead. Fixes #9194 --- tests/macros/t9194.nim | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tests/macros/t9194.nim (limited to 'tests') 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 -- cgit 1.4.1-2-gfad0