mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-13 06:43:52 +00:00
Update newLit set[T] to work when set is empty. (#14662)
* Update macros.nim * Update lib/core/macros.nim Co-authored-by: Clyybber <darkmine956@gmail.com> Co-authored-by: Clyybber <darkmine956@gmail.com>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user