newLit emty seq fix (#6091)
* the type of the empty seq is still the correct type * updated test
This commit is contained in:
parent
03e0aa37e3
commit
52cab78ae5
2 changed files with 19 additions and 3 deletions
|
|
@ -527,10 +527,17 @@ proc newLit*[N,T](arg: array[N,T]): NimNode {.compileTime.} =
|
|||
result.add newLit(x)
|
||||
|
||||
proc newLit*[T](arg: seq[T]): NimNode {.compileTime.} =
|
||||
result = nnkBracket.newTree
|
||||
var bracket = nnkBracket.newTree
|
||||
for x in arg:
|
||||
result.add newLit(x)
|
||||
result = nnkPrefix.newTree(bindSym"@", result)
|
||||
bracket.add newLit(x)
|
||||
|
||||
result = nnkCall.newTree(
|
||||
nnkBracketExpr.newTree(
|
||||
nnkAccQuoted.newTree( bindSym"@" ),
|
||||
getTypeInst( bindSym"T" )
|
||||
),
|
||||
bracket
|
||||
)
|
||||
|
||||
proc newLit*(arg: tuple): NimNode {.compileTime.} =
|
||||
result = nnkPar.newTree
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue