summary refs log tree commit diff stats
path: root/compiler/nimsets.nim
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/nimsets.nim')
-rw-r--r--compiler/nimsets.nim9
1 files changed, 7 insertions, 2 deletions
diff --git a/compiler/nimsets.nim b/compiler/nimsets.nim
index 8683604af..7edf55278 100644
--- a/compiler/nimsets.nim
+++ b/compiler/nimsets.nim
@@ -12,6 +12,9 @@
 import
   ast, astalgo, lineinfos, bitsets, types, options
 
+when defined(nimPreviewSlimSystem):
+  import std/assertions
+
 proc inSet*(s: PNode, elem: PNode): bool =
   assert s.kind == nkCurly
   if s.kind != nkCurly:
@@ -59,8 +62,10 @@ proc someInSet*(s: PNode, a, b: PNode): bool =
   result = false
 
 proc toBitSet*(conf: ConfigRef; s: PNode): TBitSet =
-  var first, j: Int128
-  first = firstOrd(conf, s.typ[0])
+  result = @[]
+  var first: Int128 = Zero
+  var j: Int128 = Zero
+  first = firstOrd(conf, s.typ.elementType)
   bitSetInit(result, int(getSize(conf, s.typ)))
   for i in 0..<s.len:
     if s[i].kind == nkRange: