mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 21:35:58 +00:00
![]() ## Summary This PR adds `Type::call_bound` method for calls that should follow descriptor protocol calling convention. The PR is intentionally shallow in scope and only fixes #15672 Couple of obvious things that weren't done: * Switch to `call_bound` everywhere it should be used * Address the fact, that red_knot resolves `__bool__ = bool` as a Union, which includes `Type::Dynamic` and hence fails to infer that the truthiness is always false for such a class (I've added a todo comment in mdtests) * Doesn't try to invent a new type for descriptors, although I have a gut feeling it may be more convenient in the end, instead of doing method lookup each time like I did in `call_bound` ## Test Plan * extended mdtests with 2 examples from the issue * cargo neatest run |
||
---|---|---|
.. | ||
custom.md | ||
integers.md | ||
invert_add_usub.md | ||
not.md |