mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-16 16:14:20 +00:00
fixes #5314
This commit is contained in:
@@ -1210,7 +1210,7 @@ proc genSeqConstr(p: BProc, t: PNode, d: var TLoc) =
|
||||
|
||||
proc genArrToSeq(p: BProc, t: PNode, d: var TLoc) =
|
||||
var elem, a, arr: TLoc
|
||||
if t.kind == nkBracket:
|
||||
if t.sons[1].kind == nkBracket:
|
||||
t.sons[1].typ = t.typ
|
||||
genSeqConstr(p, t.sons[1], d)
|
||||
return
|
||||
|
||||
17
tests/async/tasync_in_seq_constr.nim
Normal file
17
tests/async/tasync_in_seq_constr.nim
Normal file
@@ -0,0 +1,17 @@
|
||||
discard """
|
||||
output: '''@[1, 2, 3, 4]'''
|
||||
"""
|
||||
|
||||
# bug #5314
|
||||
|
||||
import asyncdispatch
|
||||
|
||||
proc bar(): Future[int] {.async.} =
|
||||
await sleepAsync(500)
|
||||
result = 3
|
||||
|
||||
proc foo(): Future[seq[int]] {.async.} =
|
||||
await sleepAsync(500)
|
||||
result = @[1, 2, await bar(), 4] # <--- The bug is here
|
||||
|
||||
echo waitFor foo()
|
||||
Reference in New Issue
Block a user