diff options
author | Ryan McConnell <rammcconnell@gmail.com> | 2023-12-15 06:48:34 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-15 07:48:34 +0100 |
commit | 94f7e9683fb5c9f643b7e4af367a3a6457d5ad7f (patch) | |
tree | d7260ac54584a8c8f56dfa55608681399cc0205f /lib/pure/sugar.nim | |
parent | 3a5b72903424499c60ac0e818828f0cc28f406de (diff) | |
download | Nim-94f7e9683fb5c9f643b7e4af367a3a6457d5ad7f.tar.gz |
Param match relax (#23033)
#23032 --------- Co-authored-by: Nikolay Nikolov <nickysn@gmail.com> Co-authored-by: Pylgos <43234674+Pylgos@users.noreply.github.com> Co-authored-by: Andreas Rumpf <rumpf_a@web.de> Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com> Co-authored-by: Jason Beetham <beefers331@gmail.com>
Diffstat (limited to 'lib/pure/sugar.nim')
-rw-r--r-- | lib/pure/sugar.nim | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/pure/sugar.nim b/lib/pure/sugar.nim index cfa04a837..7833ed063 100644 --- a/lib/pure/sugar.nim +++ b/lib/pure/sugar.nim @@ -345,9 +345,10 @@ proc collectImpl(init, body: NimNode): NimNode {.since: (1, 1).} = let res = genSym(nskVar, "collectResult") var bracketExpr: NimNode if init != nil: - expectKind init, {nnkCall, nnkIdent, nnkSym} + expectKind init, {nnkCall, nnkIdent, nnkSym, nnkClosedSymChoice, nnkOpenSymChoice} bracketExpr = newTree(nnkBracketExpr, - if init.kind == nnkCall: freshIdentNodes(init[0]) else: freshIdentNodes(init)) + if init.kind in {nnkCall, nnkClosedSymChoice, nnkOpenSymChoice}: + freshIdentNodes(init[0]) else: freshIdentNodes(init)) else: bracketExpr = newTree(nnkBracketExpr) let (resBody, keyType, valueType) = trans(body, res, bracketExpr) |