parent
2a59f499e9
commit
059a16b34d
2 changed files with 19 additions and 2 deletions
|
|
@ -639,8 +639,7 @@ proc semTemplateDef(c: PContext, n: PNode): PNode =
|
|||
for i in 1 .. s.typ.n.len-1:
|
||||
let param = s.typ.n.sons[i].sym
|
||||
param.flags.incl sfTemplateParam
|
||||
if optNimV019 in c.config.globalOptions:
|
||||
param.flags.excl sfGenSym
|
||||
param.flags.excl sfGenSym
|
||||
if param.typ.kind != tyUntyped: allUntyped = false
|
||||
if len(gp) > 0:
|
||||
if n.sons[genericParamsPos].kind == nkEmpty:
|
||||
|
|
|
|||
|
|
@ -70,3 +70,21 @@ macro makeProc(): typed =
|
|||
makeProc()
|
||||
|
||||
someProc()
|
||||
|
||||
# bug #12193
|
||||
import macros, strutils
|
||||
|
||||
macro gen(T: typedesc): untyped =
|
||||
let typeSym = getTypeImpl(T)[1]
|
||||
let param = genSym(nskParam, "s")
|
||||
let value = nnkBracketExpr.newTree(param, newIntLitNode(0))
|
||||
result = newProc(
|
||||
name = ident"pack",
|
||||
params = [typeSym,
|
||||
newIdentDefs(param, nnkBracketExpr.newTree(ident"seq", ident"string"))],
|
||||
body = newStmtList(newCall(typeSym, newCall(bindSym"parseInt", value))),
|
||||
procType = nnkTemplateDef)
|
||||
echo repr result
|
||||
|
||||
gen(int)
|
||||
let i = pack(@["2"])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue