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

Fix EntityMap merging #962

Merged
merged 2 commits into from
Jan 5, 2023
Merged

Fix EntityMap merging #962

merged 2 commits into from
Jan 5, 2023

Conversation

byorgey
Copy link
Member

@byorgey byorgey commented Jan 5, 2023

Fixes #961. Merging the entitiesByCap maps simply with (<>) (which is the same as M.union) was not correct: map union is left-biased, so if both maps had entities keyed to the same capability, the entities from the right-hand map would simply be thrown away. Instead, we must merge them with M.unionWith (<>) which will append the two Entity lists for a given capability.

Fixes #961.  Merging the `entitiesByCap` maps simply with
`(<>)` (which is the same as `M.union`) was not correct: map union is
left-biased, so if both maps had entities keyed to the same
capability, the entities from the right-hand map would simply be
thrown away.
@byorgey byorgey requested a review from xsebek January 5, 2023 17:09
Copy link
Member

@xsebek xsebek left a comment

Choose a reason for hiding this comment

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

Nice find, that <> looked perfectly valid to me. 👍

@byorgey byorgey added the merge me Trigger the merge process of the Pull request. label Jan 5, 2023
@mergify mergify bot merged commit 508d21d into main Jan 5, 2023
@mergify mergify bot deleted the fix/issue-961 branch January 5, 2023 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge me Trigger the merge process of the Pull request.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Custom entities with capabilities are not used to provide the capability
2 participants