mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-01 19:02:18 +00:00
keep param pragmas in typed proc AST (#24711)
fixes #24702
(cherry picked from commit 1f8da3835f)
This commit is contained in:
@@ -1501,7 +1501,10 @@ proc semProcTypeNode(c: PContext, n, genericParams: PNode,
|
||||
addParamOrResult(c, arg, kind)
|
||||
styleCheckDef(c, a[j].info, arg)
|
||||
onDef(a[j].info, arg)
|
||||
a[j] = newSymNode(arg)
|
||||
if a[j].kind == nkPragmaExpr:
|
||||
a[j][0] = newSymNode(arg)
|
||||
else:
|
||||
a[j] = newSymNode(arg)
|
||||
|
||||
var r: PType = nil
|
||||
if n[0].kind != nkEmpty:
|
||||
|
||||
16
tests/pragmas/tparamcustompragma.nim
Normal file
16
tests/pragmas/tparamcustompragma.nim
Normal file
@@ -0,0 +1,16 @@
|
||||
discard """
|
||||
nimout: '''
|
||||
proc foo(a {.attr.}: int) =
|
||||
discard
|
||||
|
||||
'''
|
||||
"""
|
||||
|
||||
# fixes #24702
|
||||
|
||||
import macros
|
||||
template attr*() {.pragma.}
|
||||
proc foo(a {.attr.}: int) = discard
|
||||
macro showImpl(a: typed) =
|
||||
echo repr getImpl(a)
|
||||
showImpl(foo)
|
||||
Reference in New Issue
Block a user