diff options
author | Neelesh Chandola <neelesh.chandola@outlook.com> | 2018-12-13 16:44:25 +0530 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-12-13 12:14:25 +0100 |
commit | 6bdf7fdbce49a4e356e62ed4429cfa6189185f15 (patch) | |
tree | c194fa62cacf9325469b2eb327847e73ebb0ef06 /compiler | |
parent | 9cc4a57768156883acc4e8190c78a69ed2c3d526 (diff) | |
download | Nim-6bdf7fdbce49a4e356e62ed4429cfa6189185f15.tar.gz |
enum types can now be assigned values from enum with holes (#9958)
* Fixes https://github.com/nim-lang/Nim/issues/9952 * Remove workaround from vccexe
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/semtypes.nim | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim index f4ff97ba4..7159e17e7 100644 --- a/compiler/semtypes.nim +++ b/compiler/semtypes.nim @@ -90,7 +90,7 @@ proc semEnum(c: PContext, n: PNode, prev: PType): PType = if sonsLen(v) == 2: strVal = v.sons[1] # second tuple part is the string value if skipTypes(strVal.typ, abstractInst).kind in {tyString, tyCString}: - if not isOrdinalType(v.sons[0].typ): + if not isOrdinalType(v.sons[0].typ, allowEnumWithHoles=true): localError(c.config, v.sons[0].info, errOrdinalTypeExpected) x = getOrdValue(v.sons[0]) # first tuple part is the ordinal else: @@ -101,7 +101,7 @@ proc semEnum(c: PContext, n: PNode, prev: PType): PType = strVal = v x = counter else: - if not isOrdinalType(v.typ): + if not isOrdinalType(v.typ, allowEnumWithHoles=true): localError(c.config, v.info, errOrdinalTypeExpected) x = getOrdValue(v) if i != 1: |