diff options
author | Juan M Gómez <info@jmgomez.me> | 2023-06-15 17:50:00 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-15 18:50:00 +0200 |
commit | 4937aa952b35975fdc76a627ab25116d9b38800b (patch) | |
tree | 5bcd7579e9949547fdc0824405cb2e97a9624615 /compiler | |
parent | edb64bcff445d9bfbcf715b697256b230f54c14e (diff) | |
download | Nim-4937aa952b35975fdc76a627ab25116d9b38800b.tar.gz |
adds another pass for sets fixes #6259 (#22099)
* adds another pass for sets fixes #6259 * Update tsets.nim removes extra `#`
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/semdata.nim | 2 | ||||
-rw-r--r-- | compiler/semtypes.nim | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/compiler/semdata.nim b/compiler/semdata.nim index bf0f73f80..ddd8d33ef 100644 --- a/compiler/semdata.nim +++ b/compiler/semdata.nim @@ -168,7 +168,7 @@ type sideEffects*: Table[int, seq[(TLineInfo, PSym)]] # symbol.id index inUncheckedAssignSection*: int importModuleLookup*: Table[int, seq[int]] # (module.ident.id, [module.id]) - skipTypes*: seq[PNode] # used to skip types between passes in type section. So far only used for inheritance. + skipTypes*: seq[PNode] # used to skip types between passes in type section. So far only used for inheritance and sets. template config*(c: PContext): ConfigRef = c.graph.config diff --git a/compiler/semtypes.nim b/compiler/semtypes.nim index b342356f8..aa5f0a79b 100644 --- a/compiler/semtypes.nim +++ b/compiler/semtypes.nim @@ -166,7 +166,9 @@ proc semSet(c: PContext, n: PNode, prev: PType): PType = addSonSkipIntLit(result, base, c.idgen) if base.kind in {tyGenericInst, tyAlias, tySink}: base = lastSon(base) if base.kind notin {tyGenericParam, tyGenericInvocation}: - if not isOrdinalType(base, allowEnumWithHoles = true): + if base.kind == tyForward: + c.skipTypes.add n + elif not isOrdinalType(base, allowEnumWithHoles = true): localError(c.config, n.info, errOrdinalTypeExpected % typeToString(base, preferDesc)) elif lengthOrd(c.config, base) > MaxSetElements: localError(c.config, n.info, errSetTooBig) |