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

Define subtyping of unions with type difference #566

Draft
wants to merge 27 commits into
base: master
Choose a base branch
from

Conversation

erszcz
Copy link
Collaborator

@erszcz erszcz commented May 31, 2024

This borrows the idea of defining the subtyping relation from set-theoretic types, but we only use it for subtyping of unions. This issue was made clearly visible in @xxdavid's #564 and we spoke about it face to face on Lambda Days earlier this week.

However, there are some basic tests which stopped passing, like test/should_pass/guard.erl or lookup/2 in poly_should_pass.erl, so it needs more investigation. The main troublemaker, different_normalization_levels.erl, works now, though.

@xxdavid
Copy link
Collaborator

xxdavid commented Jun 1, 2024

Impressive, thanks for trying it out! It breaks when any() is used, for example any() | not_found <: float() | not_found and false | true <: integer() | any() do not hold any more, but this can probably be tweaked somehow.

erszcz added 27 commits June 2, 2024 21:01
Sadly, this doesn't work, as init_per_suite/1 is called after all/0,
so a suite with all/0 not returning any tests is not run :(
…nfo_pass.erl

This is necessary to avoid a problem with the test module name being used as a generated test name,
which is a function name. It lead to a name clash with preexisting module_info/1, which is defined
for every module.
This solves the problem captured in
test/known_problems/should_pass/different_normalization_levels.erl
but leads to a lot of other test failures.
@erszcz erszcz force-pushed the define-union-subtype-with-typediff branch from bcf8fea to 4f1468f Compare June 2, 2024 21:07
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