ruff/crates/red_knot_python_semantic
Micha Reiser 2095ea8372
Add scope assertion to TypeInference.extend (#13764)
## 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`
2024-10-16 08:44:25 -07:00
..
resources [red-knot] Add control flow for try/except blocks (#13729) 2024-10-16 13:03:59 +00:00
src Add scope assertion to TypeInference.extend (#13764) 2024-10-16 08:44:25 -07:00
tests [red-knot] document test framework (#13695) 2024-10-10 12:02:01 -07:00
build.rs [red-knot] Add a build.rs file to red_knot_python_semantic, and document pitfalls of using rstest in combination with mdtest (#13747) 2024-10-14 13:02:03 +01:00
Cargo.toml [red knot] Use memmem::find instead of custom version (#13750) 2024-10-14 15:17:19 +02:00