ruff
b142e7b4 - [ty] Use try-call-dunder pattern for `__class_getitem__` (#23066)

Commit
238 days ago
[ty] Use try-call-dunder pattern for `__class_getitem__` (#23066) ## Summary I think `__class_getitem__` is a bit different than (e.g.) `__contains__` because it's called on the class itself, not instances... So given `Identity[0]` where `Identity` is a class, using `try_call_dunder` would call `member_lookup_with_policy` with `NO_INSTANCE_FALLBACK`, which would look at the metaclass, but not `Identity` itself. I added `try_call_dunder_on_class` for consistency which calls `member` (without `NO_INSTANCE_FALLBACK`), though as far as this PR is concerned, I think our current behavior was ok? Closes https://github.com/astral-sh/ty/issues/190. --------- Co-authored-by: David Peter <mail@david-peter.de>
Author
Parents
Loading