mirror of
https://github.com/astral-sh/ruff
synced 2026-01-11 08:34:29 -05:00
## Summary We have some logic in the expression analyzer method to avoid re-checking the inner `Union` in `Union[Union[...]]`, since the methods that analyze `Union` expressions already recurse. Elsewhere, we have logic to avoid re-checking the inner `|` in `int | (int | str)`, for the same reason. This PR unifies that logic into a single method _and_ ensures that, just as we recurse over both `Union` and `|`, we also detect that we're in _either_ kind of nested union. Closes https://github.com/astral-sh/ruff/issues/6285. ## Test Plan Added some new snapshots.