feat: Warn about unreachable variables#4567
Merged
clason merged 2 commits intotree-sitter:masterfrom Jul 21, 2025
Merged
Conversation
Closes tree-sitter#4565. I added this warning as a `println!`, similarly to the existing warnings for unnecessary conflict declaration. Ideally, those should be a `log::warn`, but the logging system is only initialized when the user has passed `-l` / `--log` on the CLI. Turning such warnings into logging statements would also make them easier to unit test, for instance via the `testing_logger` crate.
8ea0852 to
2cfbaf2
Compare
Contributor
|
That sounds like a general refactor worth doing (as long as the warnings are still printed to stdout/stderr by default). |
Co-authored-by: ObserverOfTime <chronobserver@disroot.org>
clason
approved these changes
Jul 21, 2025
Contributor
|
Hmm, this triggers false positives in tree-sitter-markdown, where a rule is defined in I think we may have to revert that until we have better (Info/Hint) output. |
clason
added a commit
that referenced
this pull request
Jul 21, 2025
This reverts commit 25c601b. Reason: Too many false positives.
clason
added a commit
that referenced
this pull request
Jul 22, 2025
This reverts commit 25c601b. Reason: Too many false positives.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #4565.
I added this warning as a
println!, similarly to the existing warnings for unnecessary conflict declarations. Ideally, those should be usinglog::warn, but the logging system is only initialized when the user has passed-l/--logon the CLI.Turning such warnings into logging statements would also make them easier to unit test, for instance via the
testing_loggercrate.