parent
4005f0d0e4
commit
9874981e75
4 changed files with 8 additions and 7 deletions
|
|
@ -1276,7 +1276,7 @@ proc typeRel(c: var TCandidate, f, aOrig: PType,
|
|||
of tyNil: result = allowsNilDeprecated(c, f)
|
||||
else: discard
|
||||
of tyOrdinal:
|
||||
if isOrdinalType(a):
|
||||
if isOrdinalType(a, allowEnumWithHoles = optNimV1Emulation in c.c.config.globalOptions):
|
||||
var x = if a.kind == tyOrdinal: a[0] else: a
|
||||
if f[0].kind == tyNone:
|
||||
result = isGeneric
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ proc enumHasHoles*(t: PType): bool =
|
|||
proc isOrdinalType*(t: PType, allowEnumWithHoles: bool = false): bool =
|
||||
assert(t != nil)
|
||||
const
|
||||
baseKinds = {tyChar,tyInt..tyInt64,tyUInt..tyUInt64,tyBool,tyEnum}
|
||||
baseKinds = {tyChar, tyInt..tyInt64, tyUInt..tyUInt64, tyBool, tyEnum}
|
||||
parentKinds = {tyRange, tyOrdinal, tyGenericInst, tyAlias, tySink, tyDistinct}
|
||||
result = (t.kind in baseKinds and (not t.enumHasHoles or allowEnumWithHoles)) or
|
||||
(t.kind in parentKinds and isOrdinalType(t.lastSon, allowEnumWithHoles))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue