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

rebar3_dialyzer_format: Add missing message formatting #2772

Merged

Conversation

gonzalobf
Copy link
Contributor

Add missing message string formatting to rebar3_dialyzer_format.

The messages are specify in the dialyzer.erl so I ran the following commands for finding missing messages:

grep '^message_to_string' otp/lib/dialyzer/src/dialyzer.erl |  sed 's/message_to_string({\([a-z_]*\),.*/\1/g' | sort > /tmp/otp.txt
grep '^message_to_string' rebar3/apps/src/rebar_dialyzer_format.erl | sed 's/message_to_string({\([a-z_]*\),.*/\1/g' | sort > /tmp/rebar3.txt

The missing message types are callback_not_exported, contract_with_opaque, map_update, missing_range. The file already have a message formatting for invalid_contract but it has been divided in two functions in OTP project so my command shows it.
race_condition was deprecated in OTP-25.

7a8
> callback_not_exported
17a19
> contract_with_opaque
27a30,32
> invalid_contract
> map_update
> missing_range
42d46
< race_condition

Add missing message string formatting to `rebar3_dialyzer_format`.

I ran the following commands for finding missing messages
```
grep '^message_to_string' lib/dialyzer/src/dialyzer.erl |  sed 's/message_to_string({\([a-z_]*\),.*/\1/g' | sort > /tmp/otp.txt
grep '^message_to_string' src/rebar_dialyzer_format.erl | sed 's/message_to_string({\([a-z_]*\),.*/\1/g' | sort > /tmp/rebar3.txt
```
The missing message types are `callback_not_exported`,
`contract_with_opaque` and `map_update`. We already have `invalid_contract`
but it has been divided in two functions in OTP project.
`race_condition` was deprecated in OTP-25.
```
diff /tmp/rebar3.txt /tmp/otp.txt
7a8
> callback_not_exported
17a19
> contract_with_opaque
27a30,31
> invalid_contract
> map_update
43d46
< race_condition
```
Copy link
Collaborator

@ferd ferd left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution!

Copy link
Collaborator

@ferd ferd left a comment

Choose a reason for hiding this comment

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

Sorry, the change to race_condition -> race_conditions breaks compatibility right now.

message_to_string({race_condition, [M, F, Args, Reason]}) ->
% race_conditions was deleted in OTP-25
% https://github.com/erlang/otp/pull/5502
message_to_string({race_conditions, [M, F, Args, Reason]}) ->
Copy link
Collaborator

Choose a reason for hiding this comment

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

Actually, looking at the original PR, the atom was not plural. We need to keep it as-is for backwards compat https://github.com/erlang/otp/pull/5502/files#diff-14627674b25a85392c29df29ffc6934257ad6f8a2a502cdea3350a272236e883

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 I dropped the commit that contained the change.

@gonzalobf gonzalobf force-pushed the rebar3-dialyzer-format-add-missing-messages branch from 35466b1 to 9aa9f87 Compare February 25, 2023 17:26
@ferd ferd merged commit 7fa21c6 into erlang:main Feb 25, 2023
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.

2 participants