mirror of
https://github.com/astral-sh/ruff
synced 2026-01-21 13:30:49 -05:00
## Summary This PR adds a debug assertion that asserts that `TypeInference::extend` is only called on results that have the same scope. This is critical because `expressions` uses `ScopedExpressionId` that are local and merging expressions from different scopes would lead to incorrect expression types. We could consider storing `scope` only on `TypeInference` for debug builds. Doing so has the advantage that the `TypeInference` type is smaller of which we'll have many. However, a `ScopeId` is a `u32`... so it shouldn't matter that much and it avoids storing the `scope` both on `TypeInference` and `TypeInferenceBuilder` ## Test Plan `cargo test`