ruff/crates/ty_python_semantic/resources/mdtest/narrow
Matthew Mckee b30d97e5e0
[ty] Support __setitem__ and improve __getitem__ related diagnostics (#19578)
## Summary

Adds validation to subscript assignment expressions.

```py
class Foo: ...

class Bar:
    __setattr__ = None

class Baz:
    def __setitem__(self, index: str, value: int) -> None:
        pass

# We now emit a diagnostic on these statements
Foo()[1] = 2
Bar()[1] = 2
Baz()[1] = 2

```

Also improves error messages on invalid `__getitem__` expressions

## Test Plan

Update mdtests and add more to `subscript/instance.md`

---------

Co-authored-by: David Peter <sharkdp@users.noreply.github.com>
Co-authored-by: David Peter <mail@david-peter.de>
2025-08-01 09:23:27 +02:00
..
conditionals [ty] improve lazy scope place lookup (#19321) 2025-07-25 07:11:11 +00:00
assert.md
assignment.md [ty] Support __setitem__ and improve __getitem__ related diagnostics (#19578) 2025-08-01 09:23:27 +02:00
bool-call.md
boolean.md
complex_target.md [ty] Homogeneous and mixed tuples (#18600) 2025-06-20 18:23:54 -04:00
hasattr.md [ty] Attribute access on intersections with negative parts (#19524) 2025-07-25 14:56:14 +02:00
isinstance.md [ty] Support narrowing on isinstance()/issubclass() if the second argument is a dynamic, intersection, union or typevar type (#18900) 2025-06-24 10:55:26 +00:00
issubclass.md [ty] Support narrowing on isinstance()/issubclass() if the second argument is a dynamic, intersection, union or typevar type (#18900) 2025-06-24 10:55:26 +00:00
match.md [ty] Improve disjointness inference for NominalInstanceTypes and SubclassOfTypes (#18864) 2025-06-24 20:27:37 +00:00
post_if_statement.md
truthiness.md [ty] Reachability constraints (#18621) 2025-06-17 09:24:28 +02:00
type.md [ty] Surface matched overload diagnostic directly (#18452) 2025-06-20 08:36:49 +05:30
type_guards.md [ty] Splat variadic arguments into parameter list (#18996) 2025-07-22 14:33:08 -04:00
while.md [ty] Eagerly simplify 'True' and 'False' constraints (#18998) 2025-06-30 13:11:52 +02:00