mirror of
https://github.com/nim-lang/Nim.git
synced 2026-05-24 21:59:52 +00:00
@@ -223,7 +223,7 @@ proc semSet(c: PContext, n: PNode, prev: PType): PType =
|
||||
if base.kind in {tyGenericInst, tyAlias, tySink}: base = skipModifier(base)
|
||||
if base.kind notin {tyGenericParam, tyGenericInvocation}:
|
||||
if base.kind == tyForward:
|
||||
c.forwardTypeUpdates.add (getCurrOwner(c), base, n[1])
|
||||
c.forwardTypeUpdates.add (getCurrOwner(c), result, n)
|
||||
elif not isOrdinalType(base, allowEnumWithHoles = true):
|
||||
localError(c.config, n.info, errOrdinalTypeExpected % typeToString(base, preferDesc))
|
||||
elif lengthOrd(c.config, base) > MaxSetElements:
|
||||
|
||||
7
tests/types/tillegalset.nim
Normal file
7
tests/types/tillegalset.nim
Normal file
@@ -0,0 +1,7 @@
|
||||
discard """
|
||||
errormsg: "set is too large; use `std/sets` for ordinal types with more than 2^16 elements"
|
||||
"""
|
||||
|
||||
type
|
||||
Foo = set[Bar]
|
||||
Bar = int32
|
||||
8
tests/types/tillegalset2.nim
Normal file
8
tests/types/tillegalset2.nim
Normal file
@@ -0,0 +1,8 @@
|
||||
discard """
|
||||
errormsg: "set is too large; use `std/sets` for ordinal types with more than 2^16 elements"
|
||||
"""
|
||||
|
||||
type
|
||||
Foo = int32
|
||||
Bar = set[Baz]
|
||||
Baz = Foo
|
||||
Reference in New Issue
Block a user