summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/core/macros.nim4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/core/macros.nim b/lib/core/macros.nim
index 3590a162b..27ff063a7 100644
--- a/lib/core/macros.nim
+++ b/lib/core/macros.nim
@@ -793,6 +793,10 @@ proc newLit*[T](s: set[T]): NimNode {.compileTime.} =
   result = nnkCurly.newTree
   for x in s:
     result.add newLit(x)
+  if result.len == 0:
+    # add type cast for empty set
+    var typ = getTypeInst(typeof(s))[1]
+    result = newCall(typ,result)
 
 proc newLit*(arg: tuple): NimNode {.compileTime.} =
   result = nnkPar.newTree