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

Warning XDeclaredButNotUsed not properly displaying for recursive functions #272

Open
othd06 opened this issue Dec 26, 2024 · 0 comments
Open

Comments

@othd06
Copy link

othd06 commented Dec 26, 2024

when a function is declared but not called the language server emits the warning XDeclaredButNotUsed however for recursive functions, since the function calls itself this warning is not emitted. It seems that this warning should still be emitted though since if the only place where a function is called is in itself then it still isn't "used" as there is no possible way for it to ever actually be called or even meaningfully included in the final executable.
Steps to reproduce:

  • create a new file (or use an existing one).
  • write a recursive function such as:
    "proc a(b: int)=
    if b == 0: return false
    else: return a(b-1)"
  • observe that the language server does not provide the XDeclaredButNotUsed warning even though this function is never called from outside of itself and isn't publicly accessible from other files (and doesn't have the used pragma or any other reason not to emit the warning).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant