-
Notifications
You must be signed in to change notification settings - Fork 3k
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
erl_syntax_lib: annotate maybe_match_expr
and else_expr
correctly
#8811
erl_syntax_lib: annotate maybe_match_expr
and else_expr
correctly
#8811
Conversation
CT Test Results 2 files 13 suites 4m 41s ⏱️ Results for commit 95b849d. ♻️ This comment has been updated with latest results. To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass. See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally. Artifacts// Erlang/OTP Github Action Bot |
I just re-check and the code already results in "unsafe in maybe" error - which I think is correct behavior. |
Thanks for your pull request. Since this is a bug fix, I think it is appropriate to base it on the Could you also add a test to the While you are it, please squash the commits into one commit. It would also be nice if you can put some of the information from the description of this PR into the commit message. |
d97f353
to
c319d4b
Compare
Your new test case will not actually be run unless you add its name to the end of the list of test cases in |
a4f56b9
to
95b849d
Compare
Finally found some time for this. I think now it's correct. If I understood it correctly, no variables are bound after I'm not completely sure whether else
Error -> Error should be free or not? Currently is neither free nor bound. Is this correct behavior? FWIW: I've tested this quickly over few examples with |
Thanks for your pull request. |
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.