Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong behavior of {.hint[XDeclaredButNotUsed]: off.} if applied to definition #4647

Open
yglukhov opened this issue Aug 23, 2016 · 1 comment
Labels
Medium Priority stale Staled PR/issues; remove the label after fixing them

Comments

@yglukhov
Copy link
Member

  • If pragma is applied to symbol then XDeclaredButNotUsed hint is disabled for every symbol in module (at least thats what I observed). The following code doesn't produce any XDeclaredButNotUsed
proc p1 =
    var a {.hint[XDeclaredButNotUsed]: off.} : int
    var b: int # No XDeclaredButNotUsed message
proc p2 =
    var b : int # No XDeclaredButNotUsed message
  • {.hint[XDeclaredButNotUsed]: off.} can be applied to vars, lets, consts, types, templates, but not to procs or macros.
template foo() {.hint[XDeclaredButNotUsed]: off.} = discard # OK!
proc bar() {.hint[XDeclaredButNotUsed]: off.} = discard # Error!
test.nim(2, 18) Error: identifier expected, but found 'hint[XDeclaredButNotUsed]'

Originated from #4641.

@stale
Copy link

stale bot commented Aug 4, 2020

This issue has been automatically marked as stale because it has not had recent activity. If you think it is still a valid issue, write a comment below; otherwise it will be closed. Thank you for your contributions.

@stale stale bot added the stale Staled PR/issues; remove the label after fixing them label Aug 4, 2020
@nim-lang nim-lang deleted a comment from github-actions bot Aug 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Medium Priority stale Staled PR/issues; remove the label after fixing them
Projects
None yet
Development

No branches or pull requests

2 participants