fixes #3357
This commit is contained in:
parent
90d1ad4231
commit
f937637a92
2 changed files with 26 additions and 2 deletions
21
tests/vm/tyaytypedesc.nim
Normal file
21
tests/vm/tyaytypedesc.nim
Normal file
|
|
@ -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]
|
||||
Loading…
Add table
Add a link
Reference in a new issue