erl_syntax_lib: annotate maybe_match_expr
and else_expr
correctly
#8811
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.
maybe_match_expr
andelse_expr
were not handled properly when annotating bindings. This was causing problem with ELS and this is currently preventing me to fix the issue. The problems were both false positive and false negative diagnostics.This will probably cause problem in ELP too, so I'll kindly ping @robertoaloi @michalmuskala to take a look at this.
I didn't provide any test for this because it seems that
erl_syntax_lib
is not tested.What one can do to test this PR is to build Erlang-LS from this PR and make sure that
els_diagnostics_SUITE:bound_var_in_pattern_maybe/1
testcase passes. Testcase tests for both false negatives and false positives.What I'm not completely sure is whether:
should return bound variable or unsafe variable diagnostic? Currently it returns bound variable, but it probably should be unsafe. I'll add that to some testcase once I know what the desired behavior is.