summary refs log tree commit diff stats
path: root/lib/core
diff options
context:
space:
mode:
authorzah <zahary@gmail.com>2019-03-01 12:09:13 +0200
committerAndreas Rumpf <rumpf_a@web.de>2019-03-01 11:09:13 +0100
commite9d3c5de1998e142b1653152f2a235fdd2652b74 (patch)
tree70cad65eb6b60ccc5e9d7a686445a766b15e513e /lib/core
parent7d7cd69070c22b7e3034dcff97561a626468f09b (diff)
downloadNim-e9d3c5de1998e142b1653152f2a235fdd2652b74.tar.gz
Fix corner-case uses of newLit (#10760)
Diffstat (limited to 'lib/core')
-rw-r--r--lib/core/macros.nim16
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/core/macros.nim b/lib/core/macros.nim
index 8e6b93a11..4b9b628af 100644
--- a/lib/core/macros.nim
+++ b/lib/core/macros.nim
@@ -703,6 +703,17 @@ when compiles(float128):
     result = newNimNode(nnkFloat128Lit)
     result.floatVal = f
 
+proc newLit*(arg: enum): NimNode {.compileTime.} =
+  result = newCall(
+    arg.type.getTypeInst[1],
+    newLit(int(arg))
+  )
+
+proc newLit*[N,T](arg: array[N,T]): NimNode {.compileTime.}
+proc newLit*[T](arg: seq[T]): NimNode {.compileTime.}
+proc newLit*[T](s: set[T]): NimNode {.compileTime.}
+proc newLit*(arg: tuple): NimNode {.compileTime.}
+
 proc newLit*(arg: object): NimNode {.compileTime.} =
   result = nnkObjConstr.newTree(arg.type.getTypeInst[1])
   for a, b in arg.fieldPairs:
@@ -725,11 +736,6 @@ proc newLit*[T](arg: seq[T]): NimNode {.compileTime.} =
     ),
     bracket
   )
-proc newLit*(arg: enum): NimNode {.compileTime.} =
-  result = newCall(
-    arg.type.getTypeInst[1],
-    newLit(int(arg))
-  )
 
 proc newLit*[T](s: set[T]): NimNode {.compileTime.} =
   result = nnkCurly.newTree