Do not consider enums with holes as ordinals (#8264)

Make the compiler behave consistently with respect to what's written in
the manual.

Fixes #1239
This commit is contained in:
LemonBoy 2018-07-12 18:08:45 +02:00 • committed by Andreas Rumpf
commit 3163a0f466
3 changed files with 11 additions and 11 deletions

View file

@ -171,7 +171,7 @@ proc semTypeTraits(c: PContext, n: PNode): PNode =
proc semOrd(c: PContext, n: PNode): PNode =
result = n
let parType = n.sons[1].typ
if isOrdinalType(parType):
if isOrdinalType(parType, allowEnumWithHoles=true):
discard
elif parType.kind == tySet:
result.typ = makeRangeType(c, firstOrd(c.config, parType), lastOrd(c.config, parType), n.info)