This commit is contained in:
Andreas Rumpf
2016-10-20 15:20:27 +02:00
parent a12f503b47
commit bae3baf9cc
3 changed files with 17 additions and 2 deletions

View File

@@ -99,7 +99,8 @@ proc genericCacheGet(genericSym: PSym, entry: TInstantiation;
proc freshGenSyms(n: PNode, owner, orig: PSym, symMap: var TIdTable) =
# 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
var x = PSym(idTableGet(symMap, s))
if x == nil:

View File

@@ -1421,7 +1421,7 @@ proc rawExecute(c: PCtx, start: int, tos: PStackFrame): TFullReg =
else: regs[rc].node.strVal
if k < 0 or k > ord(high(TSymKind)):
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)
regs[ra].node = newSymNode(sym)
of opcTypeTrait:

View 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"))