mirror of
https://github.com/nim-lang/Nim.git
synced 2026-07-20 16:01:29 +00:00
fixes a collect() bug reported on the forum (#15156) [backport:1.2]
This commit is contained in:
@@ -159,7 +159,7 @@ proc semIf(c: PContext, n: PNode; flags: TExprFlags): PNode =
|
||||
if it.len == 2:
|
||||
openScope(c)
|
||||
it[0] = forceBool(c, semExprWithType(c, it[0]))
|
||||
it[1] = semExprBranch(c, it[1])
|
||||
it[1] = semExprBranch(c, it[1], flags)
|
||||
typ = commonType(typ, it[1])
|
||||
closeScope(c)
|
||||
elif it.len == 1:
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
## Nim's write tracking and also for the cursor inference.
|
||||
## The algorithm is a reinvention / variation of Steensgaard's
|
||||
## algorithm.
|
||||
## The used algorithm is "union find" with path compression.
|
||||
## The used data structure is "union find" with path compression.
|
||||
|
||||
import ast, types, lineinfos, options, msgs, renderer
|
||||
from trees import getMagic
|
||||
|
||||
@@ -394,3 +394,13 @@ when isMainModule:
|
||||
of "bird": "word"
|
||||
else: d
|
||||
assert z == @["word", "word"]
|
||||
|
||||
|
||||
proc tforum =
|
||||
let ans = collect(newSeq):
|
||||
for y in 0..10:
|
||||
if y mod 5 == 2:
|
||||
for x in 0..y:
|
||||
x
|
||||
|
||||
tforum()
|
||||
|
||||
Reference in New Issue
Block a user