-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Pushing used
suppresses the XDeclaredButNotUsed
hint for some identifiers, but not others
#22939
Labels
Comments
It's a subtle bug. I discovered it yesterday in #22913. {.push used.}
let a {.deprecated.} = 42
proc b = echo "hi"
{.pop.} Somehow for var/let/const sections, it needs a pre-existing pragma to make push in effect. Let me investigate it later. |
Yeah, the reason is that |
ringabout
added a commit
that referenced
this issue
Nov 15, 2023
narimiran
pushed a commit
that referenced
this issue
Apr 26, 2024
#22944) …var/let symbols fixes #22939 fixes #16890 Besides, it was applied to let/const/var with pragmas, now it is universally applied. ```nim {.push exportc.} proc foo = let bar = 12 echo bar {.pop.} ``` For example, the `bar` variable will be affected by `exportc`. (cherry picked from commit cecaf9c)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example
Current behavior
The compiler outputs an
XDeclaredButNotUsed
hint fora
(but notb
):Expected behavior
No such hint for
a
orb
.Nim Version
Nim 2.0.0 and devel (57ffeaf).
Additional Information
The below works as expected, to suppress both hints:
Issue #4044 was closed 5 years ago, citing the above workaround for
which still produces the
XDeclaredButNotUsed
hint for botha
andb
.The issue in the example was reported in the #main channel.
The text was updated successfully, but these errors were encountered: