You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Traceback (most recent call last):
File "/usr/local/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/local/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/Users/guido/src/mypy/mypy/__main__.py", line 5, in <module>
main(None)
File "/Users/guido/src/mypy/mypy/main.py", line 42, in main
res = type_check_only(sources, bin_dir, options)
File "/Users/guido/src/mypy/mypy/main.py", line 86, in type_check_only
options=options)
File "/Users/guido/src/mypy/mypy/build.py", line 183, in build
dispatch(sources, manager)
File "/Users/guido/src/mypy/mypy/build.py", line 1531, in dispatch
process_graph(graph, manager)
File "/Users/guido/src/mypy/mypy/build.py", line 1768, in process_graph
process_stale_scc(graph, scc)
File "/Users/guido/src/mypy/mypy/build.py", line 1856, in process_stale_scc
graph[id].write_cache()
File "/Users/guido/src/mypy/mypy/build.py", line 1512, in write_cache
self.manager)
File "/Users/guido/src/mypy/mypy/build.py", line 862, in write_cache
data = tree.serialize()
File "/Users/guido/src/mypy/mypy/nodes.py", line 271, in serialize
'names': self.names.serialize(self._fullname),
File "/Users/guido/src/mypy/mypy/nodes.py", line 2265, in serialize
data[key] = value.serialize(fullname, key)
File "/Users/guido/src/mypy/mypy/nodes.py", line 2211, in serialize
data['node'] = self.node.serialize()
File "/Users/guido/src/mypy/mypy/nodes.py", line 671, in serialize
'type': None if self.type is None else self.type.serialize(),
File "/Users/guido/src/mypy/mypy/types.py", line 837, in serialize
'items': [t.serialize() for t in self.items()],
File "/Users/guido/src/mypy/mypy/types.py", line 837, in <listcomp>
'items': [t.serialize() for t in self.items()],
File "/Users/guido/src/mypy/mypy/types.py", line 763, in serialize
for t in self.arg_types],
File "/Users/guido/src/mypy/mypy/types.py", line 763, in <listcomp>
for t in self.arg_types],
File "/Users/guido/src/mypy/mypy/types.py", line 1079, in serialize
'items': [t.serialize() for t in self.items],
File "/Users/guido/src/mypy/mypy/types.py", line 1079, in <listcomp>
'items': [t.serialize() for t in self.items],
File "/Users/guido/src/mypy/mypy/types.py", line 496, in serialize
assert not self.id.is_meta_var()
AssertionError
The text was updated successfully, but these errors were encountered:
Fixes#2804
The problem is that analyze_member_access calls freshen_function_type_vars
if the member is a function (i.e. method). This is necessary to not mix the type
variables during type inference of generic methods inside generic functions.
However, if the method does not participate in type inference, type variables
are left in meta_level = 1 state. This causes the error, since the types could not
be serialized in the middle of type inference.
In this PR I propose to restore meta_level = 0 on member access, this is safe,
since anyway, check_call always calls freshen_function_type_vars on callee (for
generic functions, generic methods, etc).
Repro:
Traceback:
The text was updated successfully, but these errors were encountered: