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

Assert intersection type when two variables are compared #5774

Merged
merged 1 commit into from May 18, 2021

Conversation

orklah
Copy link
Collaborator

@orklah orklah commented May 15, 2021

This PR aims to fix #4687. When two variables are compared, it asserts the narrowest common type for both variables.

@@ -596,10 +596,6 @@ public static function checkPropertyVisibility(
return $emit_issues ? null : true;

case self::VISIBILITY_PROTECTED:
if ($appearing_property_class === $context->self) {
Copy link
Collaborator Author

@orklah orklah May 15, 2021

Choose a reason for hiding this comment

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

This condition was flagged as redundant by this PR because it was previously checked here: https://github.com/vimeo/psalm/pull/5774/files#diff-218a87ce16087e317b1d9c674f9998fc9617b722fb0eeaa6d09c4d54032d7dbdL559

EDIT: no, it's not anymore. I removed it after it was flagged by a wrong fix for this PR, it's not reported anymore with the current fix. However, it still seem coherent so we may as well get rid of it

Copy link
Collaborator

Choose a reason for hiding this comment

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

Seems fine, it was added many eons ago and I can well believe it's redundant

@muglug muglug merged commit f62b83a into vimeo:master May 18, 2021
@muglug
Copy link
Collaborator

muglug commented May 18, 2021

Thanks!

@orklah orklah deleted the assert-common-type branch September 14, 2021 17:39
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.

PossiblyNullArgument inside an if statment with type declarations
2 participants