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
No XDeclaredButNotUsed
in overloaded function with generics
#23431
Comments
But it really is not used as you don't instantiate the generic. |
Exactly. And yet there's no |
Ah, but it is used in the generic lookup pass. :P In fact, the overload is what causes it to be an "open symchoice". Screwed if you emit the warning, screwed if you don't. |
This mixes in both Otherwise this would warn that every n is unused if no code uses proc n(x: int) = discard
proc n(x: float) = discard
proc foo*(x: int | float) =
n(x) The issue is marking the symbol of the proc itself used in general, this also doesn't give an unused warning: proc foo() =
foo() |
Sure, #20264 #22274 also an issue, but there's the higher-level semantic argument there (which I disagree with, but it's at least therefore a distinct case) that in some sense recursive functions are always used, by themselves. This is different because the |
The real solution here is to type-check generics so that the "pre pass" is not required anymore and it's clear what is going on within a generic (nothing special at all). But lacking this, the overload is not unused since you cannot just remove it and get equivalent behavior in all the edge cases. So a warning would be more harmful then helpful. |
Description
Nim Version
Current Output
Expected Output
Possible Solution
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: