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

improve literal inequality with ranges and rework GreaterThan/LessThan assertions #7511

Merged
merged 2 commits into from Jan 28, 2022

Conversation

orklah
Copy link
Collaborator

@orklah orklah commented Jan 28, 2022

I'm pretty happy with this one. I started by fixing the literal inequality reconciliation that I couldn't do before when TPositiveInt was still here. However, there was snippets I expected to be fixed by this change but weren't so I went a little deeper.

I discovered that a previous PR that introduced filtering of null value through (>/</>=/<=) operators added an isset assertion in addition to the integer comparison. However, Psalm can reconcile two assertions but struggles with negation of two assertions so it made reconciliation difficult in some cases.

I reworked the entire thing, I used the new Assertions object system as well as the two new assertions (IsGreaterThanOrEqualTo/IsLessThanOrEqualTo) to have a much nicer system (that allows me to stop considering that >=5 is >4) and I introduced a function to know if the assertions filters the null value. That way I can use only one assertion and reconcile both.

It fixes #6797
It fixes #6871
It fixes #6778
It fixes #4358

@orklah orklah added the release:fix The PR will be included in 'Fixes' section of the release notes label Jan 28, 2022
@orklah orklah merged commit 048025b into vimeo:master Jan 28, 2022
@orklah
Copy link
Collaborator Author

orklah commented Jan 28, 2022

Github broke the linked issue feature it seems...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:fix The PR will be included in 'Fixes' section of the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant