@@ -1758,6 +1758,7 @@ impl<'db> Type<'db> {
1758
1758
Type :: ClassLiteral ( _) | Type :: SubclassOf ( _) => self . to_instance ( db) ,
1759
1759
// We treat `typing.Type` exactly the same as `builtins.type`:
1760
1760
Type :: KnownInstance ( KnownInstanceType :: Type ) => KnownClass :: Type . to_instance ( db) ,
1761
+ Type :: KnownInstance ( KnownInstanceType :: Tuple ) => KnownClass :: Tuple . to_instance ( db) ,
1761
1762
Type :: Union ( union) => union. map ( db, |element| element. in_type_expression ( db) ) ,
1762
1763
Type :: Unknown => Type :: Unknown ,
1763
1764
// TODO map this to a new `Type::TypeVar` variant
@@ -2137,6 +2138,8 @@ pub enum KnownInstanceType<'db> {
2137
2138
Never ,
2138
2139
/// The symbol `typing.Any` (which can also be found as `typing_extensions.Any`)
2139
2140
Any ,
2141
+ /// The symbol `typing.Tuple` (which can also be found as `typing_extensions.Tuple`)
2142
+ Tuple ,
2140
2143
/// The symbol `typing.Type` (which can also be found as `typing_extensions.Type`)
2141
2144
Type ,
2142
2145
/// A single instance of `typing.TypeVar`
@@ -2157,6 +2160,7 @@ impl<'db> KnownInstanceType<'db> {
2157
2160
Self :: NoReturn => "NoReturn" ,
2158
2161
Self :: Never => "Never" ,
2159
2162
Self :: Any => "Any" ,
2163
+ Self :: Tuple => "Tuple" ,
2160
2164
Self :: Type => "Type" ,
2161
2165
Self :: TypeAliasType ( _) => "TypeAliasType" ,
2162
2166
}
@@ -2173,6 +2177,7 @@ impl<'db> KnownInstanceType<'db> {
2173
2177
| Self :: NoReturn
2174
2178
| Self :: Never
2175
2179
| Self :: Any
2180
+ | Self :: Tuple
2176
2181
| Self :: Type
2177
2182
| Self :: TypeAliasType ( _) => Truthiness :: AlwaysTrue ,
2178
2183
}
@@ -2188,6 +2193,7 @@ impl<'db> KnownInstanceType<'db> {
2188
2193
Self :: NoReturn => "typing.NoReturn" ,
2189
2194
Self :: Never => "typing.Never" ,
2190
2195
Self :: Any => "typing.Any" ,
2196
+ Self :: Tuple => "typing.Tuple" ,
2191
2197
Self :: Type => "typing.Type" ,
2192
2198
Self :: TypeVar ( typevar) => typevar. name ( db) ,
2193
2199
Self :: TypeAliasType ( _) => "typing.TypeAliasType" ,
@@ -2204,7 +2210,8 @@ impl<'db> KnownInstanceType<'db> {
2204
2210
Self :: NoReturn => KnownClass :: SpecialForm ,
2205
2211
Self :: Never => KnownClass :: SpecialForm ,
2206
2212
Self :: Any => KnownClass :: Object ,
2207
- Self :: Type => KnownClass :: Object ,
2213
+ Self :: Tuple => KnownClass :: SpecialForm ,
2214
+ Self :: Type => KnownClass :: SpecialForm ,
2208
2215
Self :: TypeVar ( _) => KnownClass :: TypeVar ,
2209
2216
Self :: TypeAliasType ( _) => KnownClass :: TypeAliasType ,
2210
2217
}
@@ -2231,6 +2238,7 @@ impl<'db> KnownInstanceType<'db> {
2231
2238
( "typing" | "typing_extensions" , "Union" ) => Some ( Self :: Union ) ,
2232
2239
( "typing" | "typing_extensions" , "NoReturn" ) => Some ( Self :: NoReturn ) ,
2233
2240
( "typing" | "typing_extensions" , "Never" ) => Some ( Self :: Never ) ,
2241
+ ( "typing" | "typing_extensions" , "Tuple" ) => Some ( Self :: Tuple ) ,
2234
2242
( "typing" | "typing_extensions" , "Type" ) => Some ( Self :: Type ) ,
2235
2243
_ => None ,
2236
2244
}
0 commit comments