bevy/crates/bevy_ecs/src
Vladyslav Batyrenko 71fccb2897
Improve or-with disjoint checks (#7085)
# Objective

This PR attempts to improve query compatibility checks in scenarios
involving `Or` filters.

Currently, for the following two disjoint queries, Bevy will throw a
panic:

```
fn sys(_: Query<&mut C, Or<(With<A>, With<B>)>>, _: Query<&mut C, (Without<A>, Without<B>)>) {}
``` 

This PR addresses this particular scenario.

## Solution

`FilteredAccess::with` now stores a vector of `AccessFilters`
(representing a pair of `with` and `without` bitsets), where each member
represents an `Or` "variant".
Filters like `(With<A>, Or<(With<B>, Without<C>)>` are expected to be
expanded into `A * B + A * !C`.

When calculating whether queries are compatible, every `AccessFilters`
of a query is tested for incompatibility with every `AccessFilters` of
another query.

---

## Changelog

- Improved system and query data access compatibility checks in
scenarios involving `Or` filters

---------

Co-authored-by: MinerSebas <66798382+MinerSebas@users.noreply.github.com>
Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
2023-04-17 15:16:58 +00:00
..
entity Inline more ECS functions (#8083) 2023-04-12 19:52:06 +00:00
query Improve or-with disjoint checks (#7085) 2023-04-17 15:16:58 +00:00
schedule Cleaned up panic messages (#8219) 2023-04-12 18:27:28 +00:00
storage Inline more ECS functions (#8083) 2023-04-12 19:52:06 +00:00
system Improve or-with disjoint checks (#7085) 2023-04-17 15:16:58 +00:00
world Add a scope API for world schedules (#8387) 2023-04-16 05:09:33 +00:00
archetype.rs Inline more ECS functions (#8083) 2023-04-12 19:52:06 +00:00
bundle.rs Inline more ECS functions (#8083) 2023-04-12 19:52:06 +00:00
change_detection.rs Improve documentation for set_if_neq (#8254) 2023-03-30 15:43:13 +00:00
component.rs Inline more ECS functions (#8083) 2023-04-12 19:52:06 +00:00
event.rs Move event traces to detailed_trace! (#7732) 2023-04-11 03:37:58 +00:00
lib.rs Suppress the clippy::type_complexity lint (#8313) 2023-04-06 21:27:36 +00:00
reflect.rs Bugfix: Scene reload fix (nonbreaking) (#7951) 2023-03-27 22:18:45 +00:00
removal_detection.rs Use UnsafeWorldCell to increase code quality for SystemParam (#8174) 2023-04-01 15:45:07 +00:00