mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-30 18:02:05 +00:00
fixes #19277, refs #24169, refs #18124 When pragmas are pushed to a routine, if the routine symbol AST isn't nil by the time the pushed pragmas are being processed, the pragmas are implicitly added to the symbol AST. However this is done without restriction on the pragma, if the pushed pragma isn't supposed to apply to the routine, it's still added to the routine. This is why the symbol AST for templates wasn't set before the pushed pragma processing in #18124. Now, the pragmas added to the AST are restricted to ones that apply to the given routine. This means we can set the template symbol AST earlier so that the pragmas get added to the template AST.
20 lines
290 B
Nim
20 lines
290 B
Nim
discard """
|
|
output: '''
|
|
got: 0
|
|
'''
|
|
"""
|
|
|
|
# issue #19277
|
|
|
|
import m19277_1, m19277_2
|
|
|
|
template injector(val: untyped): untyped =
|
|
template subtemplate: untyped = val
|
|
subtemplate()
|
|
|
|
template methodCall(val: untyped): untyped = val
|
|
|
|
{.push raises: [Defect].}
|
|
|
|
foo(injector(0).methodCall())
|