forked from VimPlug/jedi
Implement support for TypeVar inference for __new__
This commit is contained in:
@@ -11,6 +11,7 @@ from typing import (
|
||||
TypeVar,
|
||||
Union,
|
||||
Sequence,
|
||||
Self,
|
||||
)
|
||||
|
||||
K = TypeVar('K')
|
||||
@@ -395,3 +396,11 @@ def generic_func2(arg: T) -> Union[int, str, T]: pass
|
||||
generic_func1(b"hello")
|
||||
#? int() str() bytes()
|
||||
generic_func2(b"hello")
|
||||
|
||||
class CustomGeneric2(Generic[T_co]):
|
||||
val: T_co
|
||||
def __init__(cls, val: T_co) -> Self:
|
||||
raise NotImplementedError
|
||||
|
||||
#? int()
|
||||
CustomGeneric2(1).val
|
||||
|
||||
Reference in New Issue
Block a user