Distinct types derived from ordinal types are ordinal.

This commit is contained in:
Matthew Baulch 2016-08-11 21:11:06 +10:00
commit 8ebce3ce2b

View file

@ -151,7 +151,8 @@ proc isOrdinalType(t: PType): bool =
const const
# caution: uint, uint64 are no ordinal types! # caution: uint, uint64 are no ordinal types!
baseKinds = {tyChar,tyInt..tyInt64,tyUInt8..tyUInt32,tyBool,tyEnum} baseKinds = {tyChar,tyInt..tyInt64,tyUInt8..tyUInt32,tyBool,tyEnum}
parentKinds = {tyRange, tyOrdinal, tyConst, tyMutable, tyGenericInst} parentKinds = {tyRange, tyOrdinal, tyConst, tyMutable, tyGenericInst,
tyDistinct}
t.kind in baseKinds or (t.kind in parentKinds and isOrdinalType(t.sons[0])) t.kind in baseKinds or (t.kind in parentKinds and isOrdinalType(t.sons[0]))
proc enumHasHoles(t: PType): bool = proc enumHasHoles(t: PType): bool =