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

don't emit redundant error when checking a named type against itself #6739

Merged
merged 2 commits into from
Oct 25, 2021

Conversation

orklah
Copy link
Collaborator

@orklah orklah commented Oct 25, 2021

#6499 introduced a new regression indirectly. Psalm is now aware that $x instanceof $y means that $x is an $y, but when $x and $y have the same type, it doesn't mean the check is redundant.

For example: ErrorException and TypeError can both be represented under throwable but $x instanceof $y would return false

This will fix #6736

Copy link
Collaborator

@weirdan weirdan left a comment

Choose a reason for hiding this comment

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

I think this needs a test.

@orklah
Copy link
Collaborator Author

orklah commented Oct 25, 2021

Indeed!

@weirdan weirdan merged commit 4b0c880 into vimeo:master Oct 25, 2021
@weirdan weirdan added the release:fix The PR will be included in 'Fixes' section of the release notes label Oct 26, 2021
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.

False-Positive: RedundantCondition with instanceof
2 participants