ruff
86b01d2d - [red-knot] Correct modeling of dunder calls (#16368)

Commit
319 days ago
[red-knot] Correct modeling of dunder calls (#16368) ## Summary Model dunder-calls correctly (and in one single place), by implementing this behavior (using `__getitem__` as an example). ```py def getitem_desugared(obj: object, key: object) -> object: getitem_callable = find_in_mro(type(obj), "__getitem__") if hasattr(getitem_callable, "__get__"): getitem_callable = getitem_callable.__get__(obj, type(obj)) return getitem_callable(key) ``` See the new `calls/dunder.md` test suite for more information. The new behavior also needs much fewer lines of code (the diff is positive due to new tests). ## Test Plan New tests; fix TODOs in existing tests.
Author
Parents
Loading