diff options
author | Arne Döring <arne.doering@gmx.net> | 2018-11-09 12:15:00 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-09 12:15:00 +0100 |
commit | 573d02760ecf38082c5bae0bdc2b42e4c9f5e0d7 (patch) | |
tree | 1536cdd0a7555d9db715ea6eeaa484427825fb9a /tests/macros/tnewlit.nim | |
parent | 130c218ff9e6349060b83114b425be7d3fe4241a (diff) | |
download | Nim-573d02760ecf38082c5bae0bdc2b42e4c9f5e0d7.tar.gz |
newLit works on enum (#9662)
* newLit works on enum * remove debugging echo
Diffstat (limited to 'tests/macros/tnewlit.nim')
-rw-r--r-- | tests/macros/tnewlit.nim | 20 |
1 files changed, 20 insertions, 0 deletions
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 |