ruff/crates/red_knot_python_semantic/resources/mdtest/call
Douglas Creager c03c28d199
[red-knot] Break up call binding into two phases (#16546)
This breaks up call binding into two phases:

- **_Matching parameters_** just looks at the names and kinds
(positional/keyword) of each formal and actual parameters, and matches
them up. Most of the current call binding errors happen during this
phase.

- Once we have matched up formal and actual parameters, we can **_infer
types_** of each actual parameter, and **_check_** that each one is
assignable to the corresponding formal parameter type.

As part of this, we add information to each formal parameter about
whether it is a type form or not. Once [PEP
747](https://peps.python.org/pep-0747/) is finalized, we can hook that
up to this internal type form representation. This replaces the
`ParameterExpectations` type, which did the same thing in a more ad hoc
way.

While we're here, we add a new fluent API for building `Parameter`s,
which makes our signature constructors a bit nicer to read. We also
eliminate a TODO where we were consuming types from the argument list
instead of the bound parameter list when evaluating our special-case
known functions.

Closes #15460

---------

Co-authored-by: Micha Reiser <micha@reiser.io>
2025-03-21 09:38:11 -04:00
..
builtins.md [red-knot] Support multiple overloads when binding parameters at call sites (#16568) 2025-03-11 15:08:17 -04:00
callable_instance.md [red-knot] Handle unions of callables better (#16716) 2025-03-17 10:35:52 -04:00
constructor.md [red-knot] Format mdtest Python snippets more concisely (#13905) 2024-10-24 11:09:31 +00:00
dunder.md [red-knot] detect invalid return type (#16540) 2025-03-12 01:58:59 +00:00
function.md [red-knot] detect invalid return type (#16540) 2025-03-12 01:58:59 +00:00
getattr_static.md [red-knot] Attribute access and the descriptor protocol (#16416) 2025-03-07 22:03:28 +01:00
invalid_syntax.md [red-knot] add call checking (#15200) 2025-01-07 20:39:45 +00:00
methods.md [red-knot] Support multiple overloads when binding parameters at call sites (#16568) 2025-03-11 15:08:17 -04:00
never.md [red-knot] Never is callable and iterable. Arbitrary attributes can be accessed. (#16533) 2025-03-06 15:59:19 +00:00
subclass_of.md [red-knot] Add support for calling type[…] (#16597) 2025-03-10 13:24:13 +01:00
union.md [red-knot] Break up call binding into two phases (#16546) 2025-03-21 09:38:11 -04:00