diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/core/macros.nim | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/core/macros.nim b/lib/core/macros.nim index 04a85d355..1b0986d33 100644 --- a/lib/core/macros.nim +++ b/lib/core/macros.nim @@ -801,12 +801,14 @@ proc newLit*[T](s: set[T]): NimNode {.compileTime.} = result = newCall(typ,result) proc isNamedTuple(T: typedesc): bool {.magic: "TypeTrait".} - ## See typetraits.isNamedTuple + ## See `typetraits.isNamedTuple` proc newLit*[T: tuple](arg: T): NimNode {.compileTime.} = + ## use -d:nimHasWorkaround14720 to restore behavior prior to PR, forcing + ## a named tuple even when `arg` is unnamed. result = nnkTupleConstr.newTree - when isNamedTuple(T): - for a,b in arg.fieldPairs: + when defined(nimHasWorkaround14720) or isNamedTuple(T): + for a, b in arg.fieldPairs: result.add nnkExprColonExpr.newTree(newIdentNode(a), newLit(b)) else: for b in arg.fields: |