ruff/crates/red_knot_python_semantic/resources/mdtest/unary
Mike Perlov e15419396c
[red-knot] Fix Stack overflow in Type::bool (#15843)
## 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
2025-02-04 12:40:07 -08:00
..
custom.md Don't special-case class instances in binary expression inference (#15161) 2025-01-06 13:50:20 -05:00
integers.md [red-knot] Autoformat mdtest Python snippets using blacken-docs (#13809) 2024-10-19 15:57:06 +01:00
invert_add_usub.md [red-knot] Infer unary not operation for instances (#13827) 2024-11-13 23:31:36 +00:00
not.md [red-knot] Fix Stack overflow in Type::bool (#15843) 2025-02-04 12:40:07 -08:00