fixes #8425
This commit is contained in:
parent
1fa23e347e
commit
96c6c82d55
2 changed files with 10 additions and 2 deletions
|
|
@ -2127,7 +2127,7 @@ proc semSetConstr(c: PContext, n: PNode): PNode =
|
||||||
n.sons[i] = semExprWithType(c, n.sons[i])
|
n.sons[i] = semExprWithType(c, n.sons[i])
|
||||||
if typ == nil:
|
if typ == nil:
|
||||||
typ = skipTypes(n.sons[i].typ, {tyGenericInst, tyVar, tyLent, tyOrdinal, tyAlias, tySink})
|
typ = skipTypes(n.sons[i].typ, {tyGenericInst, tyVar, tyLent, tyOrdinal, tyAlias, tySink})
|
||||||
if not isOrdinalType(typ):
|
if not isOrdinalType(typ, allowEnumWithHoles=true):
|
||||||
localError(c.config, n.info, errOrdinalTypeExpected)
|
localError(c.config, n.info, errOrdinalTypeExpected)
|
||||||
typ = makeRangeType(c, 0, MaxSetElements-1, n.info)
|
typ = makeRangeType(c, 0, MaxSetElements-1, n.info)
|
||||||
elif lengthOrd(c.config, typ) > MaxSetElements:
|
elif lengthOrd(c.config, typ) > MaxSetElements:
|
||||||
|
|
|
||||||
|
|
@ -205,4 +205,12 @@ echo warnUninit in gNotes
|
||||||
|
|
||||||
# 7555
|
# 7555
|
||||||
doAssert {-1.int8, -2, -2}.card == 2
|
doAssert {-1.int8, -2, -2}.card == 2
|
||||||
doAssert {1, 2, 2, 3..5, 4..6}.card == 6
|
doAssert {1, 2, 2, 3..5, 4..6}.card == 6
|
||||||
|
|
||||||
|
type Foo = enum
|
||||||
|
Foo1 = 0
|
||||||
|
Foo2 = 1
|
||||||
|
Foo3 = 3
|
||||||
|
|
||||||
|
let x = { Foo1, Foo2 }
|
||||||
|
# bug #8425
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue