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

type_check_arith_op does not preserve non_neg and pos prefixes leading to false positives #572

Open
erszcz opened this issue Sep 18, 2024 · 0 comments

Comments

@erszcz
Copy link
Collaborator

erszcz commented Sep 18, 2024

This stems from compat_arith_type returning TInteger in the general case:

compat_arith_type(Ty1, Ty2, Env) ->
    TInteger = type(integer)
    ...

even if one of Ty1 or Ty2 are more specific and the operator is +.

Test:

test() ->
    Indent = string:length("123"),
    lists:duplicate(Indent + 3, " ").

Found when typechecking OTP's argparse.erl.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant