File tree Expand file tree Collapse file tree 3 files changed +37
-6
lines changed
Expand file tree Collapse file tree 3 files changed +37
-6
lines changed Original file line number Diff line number Diff line change @@ -304,23 +304,22 @@ def snapshot_definition(node: Optional[SymbolNode],
304304 snapshot_optional_type (node .var .type ),
305305 snapshot_definition (node .func , common ))
306306 elif isinstance (node , TypeInfo ):
307- # TODO:
308- # type_vars
309- # bases
310- # _promote
311307 attrs = (node .is_abstract ,
312308 node .is_enum ,
313309 node .fallback_to_any ,
314310 node .is_named_tuple ,
315311 node .is_newtype ,
316312 snapshot_optional_type (node .tuple_type ),
317313 snapshot_optional_type (node .typeddict_type ),
318- [base .fullname () for base in node .mro ])
314+ [base .fullname () for base in node .mro ],
315+ node .type_vars ,
316+ [snapshot_type (base ) for base in node .bases ],
317+ snapshot_optional_type (node ._promote ))
319318 prefix = node .fullname ()
320319 symbol_table = snapshot_symbol_table (prefix , node .names )
321320 return ('TypeInfo' , common , attrs , symbol_table )
322321 else :
323- # TODO: Handle additional types: TypeVarExpr, MypyFile, .. .
322+ # Other node types are handled elsewhere .
324323 assert False , type (node )
325324
326325
Original file line number Diff line number Diff line change @@ -680,3 +680,13 @@ B = Dict[str, S]
680680[out]
681681__main__.A
682682__main__.T
683+
684+ [case testChangeGenericBaseClassOnly]
685+ from typing import List
686+ class C(List[int]): pass
687+ [file next.py]
688+ from typing import List
689+ class C(List[str]): pass
690+ [builtins fixtures/list.pyi]
691+ [out]
692+ __main__.C
Original file line number Diff line number Diff line change @@ -1297,6 +1297,28 @@ class A: pass
12971297main:2: error: Module 'a' has no attribute 'A'
12981298==
12991299
1300+ [case testRefreshGenericAndFailInPass3]
1301+ # Failure in semantic analysis pass 3
1302+ from a import C
1303+ a: C[int]
1304+ [file a.py]
1305+ from typing import TypeVar, Generic
1306+ T = TypeVar('T')
1307+ class C(Generic[T]): pass
1308+ [file a.py.2]
1309+ from typing import TypeVar, Generic
1310+ T = TypeVar('T')
1311+ S = TypeVar('S')
1312+ class C(Generic[T, S]): pass
1313+ [file a.py.3]
1314+ from typing import TypeVar, Generic
1315+ T = TypeVar('T')
1316+ class C(Generic[T]): pass
1317+ [out]
1318+ ==
1319+ main:3: error: "C" expects 2 type arguments, but 1 given
1320+ ==
1321+
13001322[case testPrintStatement_python2]
13011323# flags: --py2
13021324import a
You can’t perform that action at this time.
0 commit comments