Closed
Description
Mypy crashes with RecursionError
when I type check this program:
from mypy_extensions import TypedDict
A = TypedDict('A', {'a': 'A'})
a: A
Output:
t2.py:3: error: Invalid type "t2.A"
Traceback (most recent call last):
File "/Users/jukka/src/mypy/scripts/mypy", line 6, in <module>
main(__file__)
File "/Users/jukka/src/mypy/mypy/main.py", line 50, in main
res = type_check_only(sources, bin_dir, options)
File "/Users/jukka/src/mypy/mypy/main.py", line 97, in type_check_only
options=options)
File "/Users/jukka/src/mypy/mypy/build.py", line 196, in build
graph = dispatch(sources, manager)
File "/Users/jukka/src/mypy/mypy/build.py", line 1769, in dispatch
process_graph(graph, manager)
File "/Users/jukka/src/mypy/mypy/build.py", line 2012, in process_graph
process_stale_scc(graph, scc, manager)
File "/Users/jukka/src/mypy/mypy/build.py", line 2107, in process_stale_scc
graph[id].semantic_analysis()
File "/Users/jukka/src/mypy/mypy/build.py", line 1664, in semantic_analysis
self.manager.semantic_analyzer.visit_file(self.tree, self.xpath, self.options, patches)
File "/Users/jukka/src/mypy/mypy/semanal.py", line 295, in visit_file
self.accept(d)
File "/Users/jukka/src/mypy/mypy/semanal.py", line 3636, in accept
node.accept(self)
File "/Users/jukka/src/mypy/mypy/nodes.py", line 859, in accept
return visitor.visit_assignment_stmt(self)
File "/Users/jukka/src/mypy/mypy/semanal.py", line 1567, in visit_assignment_stmt
s.type = self.anal_type(s.type, allow_tuple_literal=allow_tuple_literal)
File "/Users/jukka/src/mypy/mypy/semanal.py", line 1555, in anal_type
return t.accept(a)
File "/Users/jukka/src/mypy/mypy/types.py", line 189, in accept
return visitor.visit_unbound_type(self)
File "/Users/jukka/src/mypy/mypy/typeanal.py", line 292, in visit_unbound_type
return td.copy_modified(item_types=self.anal_array(list(td.items.values())),
File "/Users/jukka/src/mypy/mypy/typeanal.py", line 520, in anal_array
res.append(self.anal_type(t, nested))
File "/Users/jukka/src/mypy/mypy/typeanal.py", line 527, in anal_type
return t.accept(self)
File "/Users/jukka/src/mypy/mypy/types.py", line 189, in accept
return visitor.visit_unbound_type(self)
...
File "/Users/jukka/src/mypy/mypy/typeanal.py", line 152, in visit_unbound_type
sym = self.lookup(t.name, t)
File "/Users/jukka/src/mypy/mypy/semanal.py", line 3436, in lookup_qualified
return self.lookup(name, ctx)
RecursionError: maximum recursion depth exceeded