ruff/crates/red_knot_python_semantic
David Peter 5e64863895
[red-knot] Handle invalid assignment targets (#14325)
## Summary

This fixes several panics related to invalid assignment targets. All of
these led to some a crash, previously:
```py
(x.y := 1)  # only name-expressions are valid targets of named expressions
([x, y] := [1, 2])  # same
(x, y): tuple[int, int] = (2, 3)  # tuples are not valid targets for annotated assignments
(x, y) += 2  # tuples are not valid targets for augmented assignments
```

closes #14321
closes #14322

## Test Plan

I symlinked four files from `crates/ruff_python_parser/resources` into
the red knot corpus, as they seemed like ideal test files for this exact
scenario. I think eventually, it might be a good idea to simply include *all*
invalid-syntax examples from the parser tests into red knots corpus (I believe
we're actually not too far from that goal). Or expand the scope of the corpus
test to this directory. Then we can get rid of these symlinks again.
2024-11-13 20:50:39 +01:00
..
resources [red-knot] Add tests for member lookup on union types (#14296) 2024-11-12 14:11:55 +01:00
src [red-knot] Handle invalid assignment targets (#14325) 2024-11-13 20:50:39 +01:00
tests [red-knot] Improve mdtest output (#14213) 2024-11-11 11:03:41 +00:00
build.rs Modernize build scripts (#13837) 2024-10-20 22:35:35 +01:00
Cargo.toml Avoid cloning Name when looking up function and class types (#14092) 2024-11-04 15:52:59 +01:00