1
0
forked from VimPlug/jedi

Implement support for TypeVar inference for __new__

This commit is contained in:
Dave Halter
2026-05-01 22:51:00 +02:00
parent 55e5f0cb92
commit 8520a9958b
6 changed files with 35 additions and 20 deletions
@@ -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