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:
parent
3fec2ba5e5
commit
3163a0f466
3 changed files with 11 additions and 11 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue