diff options
author | Mathijs Saey <mathijssaey@gmail.com> | 2017-07-08 07:31:53 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2017-07-08 07:31:53 +0200 |
commit | f8266c737687e3e45e6a14a5bc39db153b6bc57d (patch) | |
tree | d2c662a5862ab984c4ab5d9d54f0bde2ba73664e | |
parent | 915ce2871fb1eb26b8238ef37d29828f1984deda (diff) | |
download | Nim-f8266c737687e3e45e6a14a5bc39db153b6bc57d.tar.gz |
Fixes #6008 (#6068)
-rw-r--r-- | compiler/semtypes.nim | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim index 0c2dd2f96..de71f1632 100644 --- a/compiler/semtypes.nim +++ b/compiler/semtypes.nim @@ -42,6 +42,8 @@ proc semEnum(c: PContext, n: PNode, prev: PType): PType = counter = lastOrd(base) + 1 rawAddSon(result, base) let isPure = result.sym != nil and sfPure in result.sym.flags + var symbols: TStrTable + if isPure: initStrTable(symbols) var hasNull = false for i in countup(1, sonsLen(n) - 1): case n.sons[i].kind @@ -87,6 +89,8 @@ proc semEnum(c: PContext, n: PNode, prev: PType): PType = addSon(result.n, newSymNode(e)) styleCheckDef(e) if sfGenSym notin e.flags and not isPure: addDecl(c, e) + if isPure and strTableIncl(symbols, e): + wrongRedefinition(e.info, e.name.s) inc(counter) if not hasNull: incl(result.flags, tfNeedsInit) |