Skip to content

Commit 5ddfc47

Browse files
committed
add test case for many type variables overload
1 parent ba86157 commit 5ddfc47

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

test-data/unit/check-overloading.test

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6782,3 +6782,28 @@ def f(x: B) -> int: ... # E: Overloaded function signatures 1 and 2 overlap wit
67826782
@overload
67836783
def f(x: T) -> str: ...
67846784
def f(x): ...
6785+
6786+
6787+
6788+
[case testOverloadOnManyTypeVariablesGenericClassDoesNotSignificantlyDegradePerformance]
6789+
from typing import Generic, TypeVar, overload
6790+
6791+
class A: pass
6792+
6793+
class B: pass
6794+
6795+
class C: pass
6796+
6797+
T1 = TypeVar("T1", A, B, C)
6798+
T2 = TypeVar("T2", A, B, C)
6799+
T3 = TypeVar("T3", A, B, C)
6800+
T4 = TypeVar("T4", A, B, C)
6801+
T5 = TypeVar("T5", A, B, C)
6802+
T6 = TypeVar("T6", A, B, C)
6803+
6804+
class Container(Generic[T1, T2, T3, T4, T5, T6]):
6805+
@overload
6806+
def f(self, t1: int, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6) -> int: ...
6807+
@overload
6808+
def f(self, t1: str, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6) -> str: ...
6809+
def f(self, t1, t2, t3, t4, t5, t6): ...

0 commit comments

Comments
 (0)