-
Notifications
You must be signed in to change notification settings - Fork 265
Closed
Labels
Description
Describe the Bug
from typing import *
T = TypeVar('T')
f: Callable[[T], T] = lambda x: x
reveal_type(f)
r: int = f(1)INFO sandbox.py:5:12-15: revealed type: (TypeVar[T]) -> TypeVar[T] [reveal-type]
ERROR sandbox.py:6:10-14: `TypeVar[T]` is not assignable to `int` [bad-assignment]
ERROR sandbox.py:6:12-13: Argument `Literal[1]` is not assignable to parameter with type `TypeVar[T]` [bad-argument-type]
Python: 3.12
The type of f should be [T](T) -> T and not (TypeVar[T]) -> TypeVar[T]
Because of this the usage of f fails with type errors.
Sandbox Link
(Only applicable for extension issues) IDE Information
No response
Reactions are currently unavailable