@@ -63,3 +63,39 @@ reveal_type(x) # N: Revealed type is 'Any'
63
63
[case testAnnotatedNoImport]
64
64
x: Annotated[int, ...] # E: Name 'Annotated' is not defined
65
65
reveal_type(x) # N: Revealed type is 'Any'
66
+
67
+ [case testAnnotatedDifferentName]
68
+ from typing_extensions import Annotated as An
69
+ x: An[int, ...]
70
+ reveal_type(x) # N: Revealed type is 'builtins.int'
71
+
72
+ [case testAnnotatedAliasSimple]
73
+ from typing import Tuple
74
+ from typing_extensions import Annotated
75
+ Alias = Annotated[Tuple[int, ...], ...]
76
+ x: Alias
77
+ reveal_type(x) # N: Revealed type is 'builtins.tuple[builtins.int]'
78
+
79
+ [case testAnnotatedAliasTypeVar]
80
+ from typing import TypeVar
81
+ from typing_extensions import Annotated
82
+ T = TypeVar('T')
83
+ Alias = Annotated[T, ...]
84
+ x: Alias[int]
85
+ reveal_type(x) # N: Revealed type is 'builtins.int'
86
+
87
+ [case testAnnotatedAliasGenericTuple]
88
+ from typing import TypeVar, Tuple
89
+ from typing_extensions import Annotated
90
+ T = TypeVar('T')
91
+ Alias = Annotated[Tuple[T, T], ...]
92
+ x: Alias[int]
93
+ reveal_type(x) # N: Revealed type is 'Tuple[builtins.int, builtins.int]'
94
+
95
+ [case testAnnotatedAliasGenericUnion]
96
+ from typing import TypeVar, Union
97
+ from typing_extensions import Annotated
98
+ T = TypeVar('T')
99
+ Alias = Annotated[Union[T, str], ...]
100
+ x: Alias[int]
101
+ reveal_type(x) # N: Revealed type is 'Union[builtins.int, builtins.str]'
0 commit comments