This commit is contained in:
Tomohiro
2026-04-21 03:13:06 +09:00
committed by GitHub
parent f236e6a210
commit ba4e12fb65
3 changed files with 16 additions and 1 deletions

View File

@@ -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:

View 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

View 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