ruff
1f43fd3d - [ty] Fix panic when inferring subscript assignment multiple times

Commit
135 days ago
[ty] Fix panic when inferring subscript assignment multiple times When subscript assignments are validated, the closure that infers the assigned type may be called multiple times with different type contexts (e.g., for union narrowing or when validating against multiple overloads). Previously, this would cause a panic due to the assertion in `store_expression_type_impl` that fails when the same expression's type is stored twice with `MultiInferenceState::Panic` (the default state). This fix follows the same pattern used by attribute assignment validation: track whether this is the first inference, and if not, temporarily set `MultiInferenceState::Overwrite` to allow overwriting previously inferred types without panicking. Fixes astral-sh/ty#2503
Author
Parents
Loading