Skip to content

[red-knot] infer types from parameter annotations #13693

@carljm

Description

@carljm

Currently we have Definitions for function parameters (that is, inside the function body we know that those names are defined), but we only infer @Todo types for those names, even if the parameter has a type annotation.

The tricky part of implementing this inference correctly is that we have to handle PEP 695 generic type parameter scopes, e.g. def f[T](x: T): ... has a special implicit scope in between the containing scope and the function's body scope, in which T is defined. So for generic functions we have to do inference of the parameter type annotations in that scope, not in the outer scope.

Metadata

Metadata

Assignees

Labels

tyMulti-file analysis & type inference

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions