From 573d02760ecf38082c5bae0bdc2b42e4c9f5e0d7 Mon Sep 17 00:00:00 2001 From: Arne Döring Date: Fri, 9 Nov 2018 12:15:00 +0100 Subject: newLit works on enum (#9662) * newLit works on enum * remove debugging echo --- tests/macros/tnewlit.nim | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'tests') diff --git a/tests/macros/tnewlit.nim b/tests/macros/tnewlit.nim index 3ba1e09e1..194f035ba 100644 --- a/tests/macros/tnewlit.nim +++ b/tests/macros/tnewlit.nim @@ -147,3 +147,23 @@ block: # x needs to be of type seq[string] var x = test_newLit_empty_seq_string x.add("xyz") + +type + MyEnum = enum + meA + meB + +macro test_newLit_Enum: untyped = + result = newLit(meA) + +block: + let tmp: MyEnum = meA + doAssert tmp == test_newLit_Enum + +macro test_newLit_set: untyped = + let myset = {MyEnum.low .. MyEnum.high} + result = newLit(myset) + +block: + let tmp: set[MyEnum] = {MyEnum.low .. MyEnum.high} + doAssert tmp == test_newLit_set -- cgit 1.4.1-2-gfad0