[red-knot] function signature representation (#14304)

## Summary

Add a typed representation of function signatures (parameters and return
type) and infer it correctly from a function.

Convert existing usage of function return types to use the signature
representation.

This does not yet add inferred types for parameters within function body
scopes based on the annotations, but it should be easy to add as a next
step.

Part of #14161 and #13693.

## Test Plan

Added tests.
This commit is contained in:
Carl Meyer
2024-11-14 15:34:24 -08:00
committed by GitHub
parent ba6c7f6897
commit a48d779c4e
8 changed files with 559 additions and 67 deletions

View File

@@ -19,6 +19,15 @@ async def get_int_async() -> int:
reveal_type(get_int_async()) # revealed: @Todo
```
## Generic
```py
def get_int[T]() -> int:
return 42
reveal_type(get_int()) # revealed: int
```
## Decorated
```py