fixes #4856
This commit is contained in:
parent
a12f503b47
commit
bae3baf9cc
3 changed files with 17 additions and 2 deletions
|
|
@ -99,7 +99,8 @@ proc genericCacheGet(genericSym: PSym, entry: TInstantiation;
|
||||||
|
|
||||||
proc freshGenSyms(n: PNode, owner, orig: PSym, symMap: var TIdTable) =
|
proc freshGenSyms(n: PNode, owner, orig: PSym, symMap: var TIdTable) =
|
||||||
# we need to create a fresh set of gensym'ed symbols:
|
# we need to create a fresh set of gensym'ed symbols:
|
||||||
if n.kind == nkSym and sfGenSym in n.sym.flags and n.sym.owner == orig:
|
if n.kind == nkSym and sfGenSym in n.sym.flags and
|
||||||
|
(n.sym.owner == orig or n.sym.owner.kind == skPackage):
|
||||||
let s = n.sym
|
let s = n.sym
|
||||||
var x = PSym(idTableGet(symMap, s))
|
var x = PSym(idTableGet(symMap, s))
|
||||||
if x == nil:
|
if x == nil:
|
||||||
|
|
|
||||||
|
|
@ -1421,7 +1421,7 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
|
||||||
else: regs[rc].node.strVal
|
else: regs[rc].node.strVal
|
||||||
if k < 0 or k > ord(high(TSymKind)):
|
if k < 0 or k > ord(high(TSymKind)):
|
||||||
internalError(c.debug[pc], "request to create symbol of invalid kind")
|
internalError(c.debug[pc], "request to create symbol of invalid kind")
|
||||||
var sym = newSym(k.TSymKind, name.getIdent, c.module, c.debug[pc])
|
var sym = newSym(k.TSymKind, name.getIdent, c.module.owner, c.debug[pc])
|
||||||
incl(sym.flags, sfGenSym)
|
incl(sym.flags, sfGenSym)
|
||||||
regs[ra].node = newSymNode(sym)
|
regs[ra].node = newSymNode(sym)
|
||||||
of opcTypeTrait:
|
of opcTypeTrait:
|
||||||
|
|
|
||||||
14
tests/async/tgenericasync.nim
Normal file
14
tests/async/tgenericasync.nim
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
discard """
|
||||||
|
output: '''123
|
||||||
|
abc'''
|
||||||
|
"""
|
||||||
|
|
||||||
|
# bug #4856
|
||||||
|
|
||||||
|
import asyncdispatch
|
||||||
|
|
||||||
|
proc say[T](t: T): Future[void] {.async.} =
|
||||||
|
echo $t
|
||||||
|
|
||||||
|
waitFor(say(123))
|
||||||
|
waitFor(say("abc"))
|
||||||
Loading…
Add table
Add a link
Reference in a new issue