diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/vm/tyaytypedesc.nim | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/vm/tyaytypedesc.nim b/tests/vm/tyaytypedesc.nim new file mode 100644 index 000000000..a3ad9b707 --- /dev/null +++ b/tests/vm/tyaytypedesc.nim @@ -0,0 +1,21 @@ +discard """ + output: "ntWhitespace" +""" + +# bug #3357 + +type NodeType* = enum + ntWhitespace + +type TokenType* = enum + ttWhitespace + +proc enumTable*[A, B, C](a: openarray[tuple[key: A, val: B]], ret: typedesc[C]): C = + for item in a: + result[item.key] = item.val + +const tokenTypeToNodeType = { + ttWhitespace: ntWhitespace, +}.enumTable(array[ttWhitespace..ttWhitespace, NodeType]) + +echo tokenTypeToNodeType[ttWhitespace] |