-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Open
Labels
bugmypy got something wrongmypy got something wrong
Description
from typing import TypeVar
T = TypeVar("T", int, str)
def foo() -> T:
return 1 # error: Incompatible return value type (got "int", expected "str") [return-value]
def bar() -> T:
return "" # error: Incompatible return value type (got "str", expected "int") [return-value]i think the error message should be something like:
Incompatible return value type (got "int", expected "T")
or maybe something more descriptive, like how typescript puts it:
'T' could be instantiated with an arbitrary type which could be unrelated to 'number'.
KotlinIsland, tomwojcik-adverity and wikiped
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrong