Implement support for TypeVar inference for __new__

This commit is contained in:
Dave Halter committed 2026-05-01 22:52:05 +02:00
1 parent 55e5f0cb92
commit 8520a9958b
6 files changed
+35 -20

No files matched your search

@@ -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