diff options
author | Araq <rumpf_a@web.de> | 2015-02-14 18:11:52 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2015-02-14 18:11:52 +0100 |
commit | ece23d39bce679be75da10e0e6b6fcf1814dca49 (patch) | |
tree | f94f4a687132e6148fdb8d01c3ca5b5eaf9c36c6 | |
parent | df2fdaf3c5fb8249c47be7566543be3482f9cb48 (diff) | |
download | Nim-ece23d39bce679be75da10e0e6b6fcf1814dca49.tar.gz |
fixes #2123
-rw-r--r-- | compiler/parser.nim | 1 | ||||
-rw-r--r-- | tests/parser/twhen_in_enum.nim | 11 |
2 files changed, 12 insertions, 0 deletions
diff --git a/compiler/parser.nim b/compiler/parser.nim index f249b37c8..8fbf033d8 100644 --- a/compiler/parser.nim +++ b/compiler/parser.nim @@ -1597,6 +1597,7 @@ proc parseEnum(p: var TParser): PNode = optInd(p, result) while true: var a = parseSymbol(p) + if a.kind == nkEmpty: return if p.tok.indent >= 0 and p.tok.indent <= p.currInd: add(result, a) break diff --git a/tests/parser/twhen_in_enum.nim b/tests/parser/twhen_in_enum.nim new file mode 100644 index 000000000..d4a3ea56a --- /dev/null +++ b/tests/parser/twhen_in_enum.nim @@ -0,0 +1,11 @@ +discard """ + errormsg: "identifier expected, but found 'keyword when'" +""" + +# bug #2123 +type num = enum + NUM_NONE = 0 + NUM_ALL = 1 + when defined(macosx): NUM_OSX = 10 # only this differs for real + NUM_XTRA = 20 + |