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

redbug_dtop: fix handling of -0.0 for OTP-26.1/27.0 #34

Merged
merged 1 commit into from
Nov 27, 2023

Conversation

mikpe
Copy link
Contributor

@mikpe mikpe commented Sep 22, 2023

Matching of floating-point zeroes will change in OTP-27 so that -0.0 will no longer match a non-negative 0.0. OTP-26.1 warns about such constructs, which in redbug results in:

===> Compiling src/redbug_dtop.erl failed
src/redbug_dtop.erl:225:9: matching on the float 0.0 will no longer also match -0.0 in OTP 27. If you specifically intend to match 0.0 alone, write +0.0 instead.

Fixed by switching from a match to a numerical comparison.

Matching of floating-point zeroes will change in OTP-27 so that -0.0 will
no longer match a non-negative 0.0. OTP-26.1 warns about such constructs,
which in redbug results in:

===> Compiling src/redbug_dtop.erl failed
src/redbug_dtop.erl:225:9: matching on the float 0.0 will no longer also match -0.0 in OTP 27. If you specifically intend to match 0.0 alone, write +0.0 instead.

Fixed by switching from a match to a numerical comparison.
@kivra-pauoli
Copy link

👋 @massemanet, any chance this gets merged+released soonish, 🥺? Thanks.

@kivra-pauoli
Copy link

In the meantime, as a workaround, those stumbling upon this can use (in e.g. rebar.config)

{overrides, [
    {add, redbug, [{erl_opts, [nowarn_match_float_zero]}]}
]}.

@massemanet
Copy link
Owner

massemanet commented Oct 4, 2023 via email

@kivra-pauoli
Copy link

@massemanet, what would be required for this get reviewed, approved, merged and tagged/released? Willing to help in any of the stages, just let me know. Thanks.

@massemanet massemanet merged commit 55fb4b0 into massemanet:master Nov 27, 2023
@massemanet
Copy link
Owner

apologies for missing this.

@mikpe mikpe deleted the fix-match-on-float-zero branch December 12, 2023 13:54
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.

3 participants