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

Fix gradualizer_int:int_type_to_range/1 crash #439

Merged
merged 4 commits into from
Aug 24, 2022

Conversation

erszcz
Copy link
Collaborator

@erszcz erszcz commented Aug 24, 2022

Fixes #438 by assuming that a type var is any number. It should probably also generate a constraint on the type var, but there's no path for returning constraints from gradualizer_int yet, so we might need to revisit this module anyway once there's a constraint solver in place.

@erszcz erszcz merged commit dad250e into josefs:master Aug 24, 2022
@erszcz erszcz deleted the int-type-to-range-crash branch August 24, 2022 17:25
Comment on lines 8 to 10
%% Caused a crash in int_type_to_range/1 on {var, _, 'A'}.
%% It's now fixed by assuming that a type var means any integer whatsoever.
foo() -> -id(42).
Copy link
Collaborator

@zuiderkwast zuiderkwast Aug 24, 2022

Choose a reason for hiding this comment

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

Well, the type variable can also be instantiated to any() or float(). What we assume is that it's a type that if an integer is included, its negation is also included, or sth like that.... We should perhaps add some constraints on the negated variable, but I don't know how that would look like or how it could work.

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.

function_clause crash in gradualizer_int:int_type_to_range
2 participants