Skip to content

Commit

Permalink
close #7546
Browse files Browse the repository at this point in the history
  • Loading branch information
cooldome committed Nov 5, 2020
1 parent 6d4e1cb commit f7d682e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/semtypes.nim
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ proc semSet(c: PContext, n: PNode, prev: PType): PType =
var base = semTypeNode(c, n[1], nil)
addSonSkipIntLit(result, base, c.idgen)
if base.kind in {tyGenericInst, tyAlias, tySink}: base = lastSon(base)
if base.kind != tyGenericParam:
if base.kind notin {tyGenericParam, tyGenericInvocation}:
if not isOrdinalType(base, allowEnumWithHoles = true):
localError(c.config, n.info, errOrdinalTypeExpected)
elif lengthOrd(c.config, base) > MaxSetElements:
Expand Down
8 changes: 8 additions & 0 deletions tests/statictypes/tstatictypes.nim
Original file line number Diff line number Diff line change
Expand Up @@ -295,3 +295,11 @@ barM()
fooParam(foo)
barParam(bar)


#-----------------------------------------------------------------------------------------
# issue #7546
type
rangeB[N: static[int16]] = range[0'i16 .. N]
setB[N: static[int16]] = set[rangeB[N]]

var s : setB[14'i16]

0 comments on commit f7d682e

Please sign in to comment.