bevy/crates/bevy_ecs/src/query
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
..
access.rs Improve or-with disjoint checks (#7085) 2023-04-17 15:16:58 +00:00
fetch.rs Improve or-with disjoint checks (#7085) 2023-04-17 15:16:58 +00:00
filter.rs Improve or-with disjoint checks (#7085) 2023-04-17 15:16:58 +00:00
iter.rs Increase type safety and clarity for change detection (#7905) 2023-03-09 17:17:02 +00:00
mod.rs Pass query change ticks to QueryParIter instead of always using change ticks from World. (#8029) 2023-03-13 22:06:16 +00:00
par_iter.rs Pass query change ticks to QueryParIter instead of always using change ticks from World. (#8029) 2023-03-13 22:06:16 +00:00
state.rs Fix inaccurate documentation on `QueryState::for_each_unchecked (#8277) 2023-03-31 16:54:36 +00:00