summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'compiler')
-rw-r--r--compiler/semdata.nim2
-rw-r--r--compiler/semtypes.nim4
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)