Repository navigation
Keep the keys of both shapes when intersecting shapes that may have unlisted keys - #7223
Merged
Merged
Conversation
…nlisted keys
A shape that is neither sealed nor unsealed may hold keys it does not
list, so its intersection with another shape keeps the keys only one of
them lists, with that shape's value. Before, the intersection was rebuilt
from the keys of one shape only, so array{a: int}&array{b: int} became
array{a: int}.
Amp-Thread-ID: https://ampcode.com/threads/T-01a21c49-c694-75f7-8560-fafa01a38f9d
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A shape that is neither sealed nor unsealed may hold keys it does not list, so its intersection with another shape now keeps the keys only one of them lists, with that shape's value. Before,
ArrayAlgebra::tryIntersectShapeWithArray()rebuilt the result from the keys of one shape only, soReport&array{column: string, metadata: array{columns: …}}lostreportData,metadata.metricsandmetadata.dimension.The same rebuild existed before ea8e0a3, but the old pairwise loop only reached it for one order of the members; the intersect pipeline reaches it for both.
Closes phpstan/phpstan#15855