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

Rule: unused-output-variable #922

Merged
merged 1 commit into from
Jul 17, 2024
Merged

Rule: unused-output-variable #922

merged 1 commit into from
Jul 17, 2024

Conversation

anderseknert
Copy link
Member

@anderseknert anderseknert commented Jul 17, 2024

One of the rules I've wanted since the project was started, but until now would this have been wildly expensive to add. With the recent fixes that allow us to reuse the result of walking the AST, that's no longer the case. Still, this required quite some time and effort to get right!

NOTE: this rule currently only considers output variables as found in references, i.e. x in input[x] and NOT x in some x, _ in input. While that would be easy to add, I'm not sure if those are really "output variables" or should be considered as such... 🤔 or if we should just have another rules for "unused iteration variable" or something like that. Either way, this is a big step forward!

Fixes #60

One of the rules I've wanted since the project was started, but not until
now would this have been wildly expensive to add. With the recent fixes
that allow us to reuse the result of `walk`ing the AST, that's no longer
the case. Still, this required quite some time and effort to get right!

NOTE: this rule currently only considers output variables as found in
references, i.e. `x` in  `input[x]` and NOT `x` in `some x, _ in input`.
While that would be easy to add, I'm not sure if those are really "output
variables" or should be considered as such... 🤔 or if we should just have
another rules for "unused iteration variable" or something like that.
Either way, this is a big step forward!

Fixes #60

Signed-off-by: Anders Eknert <[email protected]>
Copy link
Member

@charlieegan3 charlieegan3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me, nice coverage in the tests.

@anderseknert anderseknert merged commit 3abd5c0 into main Jul 17, 2024
3 checks passed
@anderseknert anderseknert deleted the unused-output-variable branch July 17, 2024 14:41
@anderseknert
Copy link
Member Author

@srenatus I’d love to hear your thoughts on my note above! Am I right in my hunch that “x” in “some x in y” isn’t an “output variable” in the unification sense?

@anderseknert
Copy link
Member Author

blank-meme-template-075-Alright-then-keep-your-secrets-55314551

srenatus pushed a commit to srenatus/regal that referenced this pull request Oct 1, 2024
One of the rules I've wanted since the project was started, but not until
now would this have been wildly expensive to add. With the recent fixes
that allow us to reuse the result of `walk`ing the AST, that's no longer
the case. Still, this required quite some time and effort to get right!

NOTE: this rule currently only considers output variables as found in
references, i.e. `x` in  `input[x]` and NOT `x` in `some x, _ in input`.
While that would be easy to add, I'm not sure if those are really "output
variables" or should be considered as such... 🤔 or if we should just have
another rules for "unused iteration variable" or something like that.
Either way, this is a big step forward!

Fixes StyraInc#60

Signed-off-by: Anders Eknert <[email protected]>
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

Successfully merging this pull request may close these issues.

Unused output variable
2 participants