Don't report unused hints for consumed AST (#18270)
* Fix #18203 * Add testcase * Fix testcase * Fix test
This commit is contained in:
parent
d3b27eb63e
commit
c5cf21c0c4
2 changed files with 18 additions and 1 deletions
|
|
@ -364,7 +364,9 @@ proc openShadowScope*(c: PContext) =
|
||||||
|
|
||||||
proc closeShadowScope*(c: PContext) =
|
proc closeShadowScope*(c: PContext) =
|
||||||
## closes the shadow scope, but doesn't merge any of the symbols
|
## closes the shadow scope, but doesn't merge any of the symbols
|
||||||
c.closeScope
|
## Does not check for unused symbols or missing forward decls since a macro
|
||||||
|
## or template consumes this AST
|
||||||
|
rawCloseScope(c)
|
||||||
|
|
||||||
proc mergeShadowScope*(c: PContext) =
|
proc mergeShadowScope*(c: PContext) =
|
||||||
## close the existing scope and merge in all defined symbols, this will also
|
## close the existing scope and merge in all defined symbols, this will also
|
||||||
|
|
|
||||||
15
tests/macros/t18203.nim
Normal file
15
tests/macros/t18203.nim
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
discard """
|
||||||
|
matrix: "--hint:SuccessX:off --hint:Link:off --hint:Conf:off --hint:CC:off --hint:XDeclaredButNotUsed:on"
|
||||||
|
nimout: '''
|
||||||
|
'''
|
||||||
|
nimoutFull: true
|
||||||
|
action: compile
|
||||||
|
"""
|
||||||
|
|
||||||
|
# bug #18203
|
||||||
|
import std/macros
|
||||||
|
|
||||||
|
macro foo(x: typed) = newProc ident"bar"
|
||||||
|
proc bar() {.foo.} = raise
|
||||||
|
bar()
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue