Closed hmc-cs-mdrissi closed 3 months ago
Describe the bug
from collections.abc import Callable from typing import TypeVar from lib import Node T = TypeVar("T") Callback = Callable[[T], None] def dec(*x: str) -> Callable[[Callback[T]], Callback[T]]: ... @dec("") def foo(x: Node): ...
lib is intentionally an unknown name as bug is specific to function with Unknown annotation (any untyped library in real use case).
This code produces an error recently of,
Untyped function decorator obscures type of function
But if I change Node to object the code type checks fine. The decorator is fully annotated, but Unknown in function confuses it somehow.
Other strange thing is this issue requires type alias Callback. If I inline alias the error goes away.
VS Code extension or command-line pyright 1.1.369
This is included in pyright 1.1.370
Describe the bug
lib is intentionally an unknown name as bug is specific to function with Unknown annotation (any untyped library in real use case).
This code produces an error recently of,
But if I change Node to object the code type checks fine. The decorator is fully annotated, but Unknown in function confuses it somehow.
Other strange thing is this issue requires type alias Callback. If I inline alias the error goes away.
VS Code extension or command-line pyright 1.1.369