@@ -425,6 +425,36 @@ def func_d2(
425425 n = ClassD2[int, float, str]()
426426 reveal_type(n) # N: Revealed type is "__main__.ClassD2[builtins.int, builtins.float, builtins.str]"
427427
428+ [case testTypeVarDefaultsClassRecursiveMultipleFiles]
429+ # flags: --disallow-any-generics
430+ from typing import Generic, TypeVar
431+ from file2 import T as T2
432+
433+ T = TypeVar('T', default=T2)
434+
435+ class ClassG1(Generic[T2, T]):
436+ pass
437+
438+ def func(
439+ a: ClassG1,
440+ b: ClassG1[str],
441+ c: ClassG1[str, float],
442+ ) -> None:
443+ reveal_type(a) # N: Revealed type is "__main__.ClassG1[builtins.int, builtins.int]"
444+ reveal_type(b) # N: Revealed type is "__main__.ClassG1[builtins.str, builtins.str]"
445+ reveal_type(c) # N: Revealed type is "__main__.ClassG1[builtins.str, builtins.float]"
446+
447+ k = ClassG1()
448+ reveal_type(k) # N: Revealed type is "__main__.ClassG1[builtins.int, builtins.int]"
449+ l = ClassG1[str]()
450+ reveal_type(l) # N: Revealed type is "__main__.ClassG1[builtins.str, builtins.str]"
451+ m = ClassG1[str, float]()
452+ reveal_type(m) # N: Revealed type is "__main__.ClassG1[builtins.str, builtins.float]"
453+
454+ [file file2.py]
455+ from typing import TypeVar
456+ T = TypeVar('T', default=int)
457+
428458[case testTypeVarDefaultsTypeAlias1]
429459# flags: --disallow-any-generics
430460from typing import Any, Dict, List, Tuple, TypeVar, Union
0 commit comments