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.
Currently, any unused value binders raise a warning. For example:
ditto/crates/ditto-checker/golden-tests/warnings/unused_function_binder.warnings
Lines 2 to 9 in 53a0eb4
ditto/crates/ditto-checker/golden-tests/warnings/unused_pattern_binder.warnings
Lines 2 to 11 in 53a0eb4
ditto/crates/ditto-checker/golden-tests/warnings/unused_effect_binder.warnings
Lines 2 to 12 in 53a0eb4
Clearly there are legitimate reasons to ignore a binding, so there needs to be a way to suppress these warnings. Most languages (and/or linters) that I'm aware of handle this by prefixing unused variables with a
_
.However this is generally just a convention, as variables marked as unused (by a leading underscore) can usually still be referenced. And I'm not the only one who would prefer it if this convention was enforced by the compiler:
rust-lang/rust#3423
golang/go#39118
Ditto will enforce this by not treating
_unused
variables as valid expressions. In this PR this is enforced at the parser level, but that might change in future in the interest of more helpful error messages...Note that this PR doesn't extend
Effect::Bind
with unused binders, that will be implemented as part of #46.