Closed
Description
from typing import TypeVar
T = TypeVar('T')
class X:
def __init__(self: T):
super().__init__() # error: Argument 2 for "super" not an instance of argument 1
Possibly related to python/typing#909? But it seems the actual super
call is handled specially so, possibly not?
It would seem to me if self
is a TypeVar
we can safely say that it must be compatible with super's arg 2...which seems like a simple fix. If T
is bound to an incompatible type we'll get errors elsewhere to cover that situation (error: The erased type of self "__main__.A" is not a supertype of its class "__main__.X"
).