diff options
author | solo989 <solo989@yahoo.com> | 2020-06-15 00:15:17 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-15 09:15:17 +0200 |
commit | 3cbf59336d6b9838dbf534f8e55fdfc8e7ab6954 (patch) | |
tree | 4e63a79f417483e5e72154518cd45553458e4870 /lib | |
parent | 571bc011eaa9eb9214291d34ca008ab41ce7ebc1 (diff) | |
download | Nim-3cbf59336d6b9838dbf534f8e55fdfc8e7ab6954.tar.gz |
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>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/core/macros.nim | 4 |
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 |