-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
bugmypy got something wrongmypy got something wrongfalse-positivemypy gave an error on correct codemypy gave an error on correct codepriority-1-normaltopic-type-variables
Description
Looking at the following example
from typing import TypeVar, Generic
class C(Generic[T]):
def __init__(self, t: T) -> None:
self.t = t
class F(Generic[K]):
def __init__(self, k: K) -> None:
self.k = k
def foo(self) -> K:
return self.k
C.F(17).foo()
C("").F(17).foo() # error: Argument 1 to "F" has incompatible type "int"; expected "str"
reveal_type(C.F) # 'def [K] (k: K`1) -> foo.C.F[K`1]' All Good
reveal_type(C("").F) # 'def [K] (k: builtins.str*) -> foo.C.F[builtins.str*]' What?
Seems like specifying the T seems to crush K somehow.
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrongfalse-positivemypy gave an error on correct codemypy gave an error on correct codepriority-1-normaltopic-type-variables