Closed
Description
The following fails now:
from typing import Optional, Type, TypeVar, overload, Union
Gid = int
A = TypeVar("A", bound="Assoc")
class Assoc:
@overload
@classmethod
def delete(cls, gid, gid2):
# type: (Type[A], Gid, Gid) -> Optional[int]
pass
@overload # noqa
@classmethod
def delete(cls, gid, gid2=None):
# type: (Type[A], A, None) -> Optional[int]
pass
@classmethod # noqa
def delete(cls, gid, gid2=None):
# type: (Type[A], Union[A, Gid], Optional[Gid]) -> Optional[int]
pass
def delete_assoc(assoc_type):
# type: (Type[Assoc]) -> None
assoc = assoc_type()
assoc.delete(10, 20)
def delete_assoc2(assoc):
# type: (Assoc) -> None
assoc.delete(10, 20)
with errors in the delete_assoc functions saying Invalid self argument "Assoc" to attribute function "delete" with type "Callable[[Type[A], int, int], Optional[int]]"
.
Looks like this was introduced in #7860.