Skip to content

Incremental type check broken #3202

Closed
@pkch

Description

@pkch

This is based on my analysis of the differences of the test results with and without builtins fixtures (#3111).

It seems that incremental type check is broken on master, unless there's something really weird with my platform.

To replicate create two files:

# b.py
from a import A

def f(x: A) -> None:
    x.g()

and

# a.py
class A:
    def g(self) -> None: pass

Then run

rm -rf .mypy_cache
mypy -i b.py
touch a.py
mypy -i b.py

This results in the following (both on Win64 and Linux):

$ mypy b.py
(mypy) [pkch@kanto mypy] 2017-04-19 22:15:03 (master)
$ mypy -i b.py
(mypy) [pkch@kanto mypy] 2017-04-19 22:15:19 (master)
$ touch a.py
(mypy) [pkch@kanto mypy] 2017-04-19 22:15:23 (master)
$ mypy -i b.py
Traceback (most recent call last):
  File "/home/pkch/.virtualenvs/mypy/bin/mypy", line 6, in <module>
    exec(compile(open(__file__).read(), __file__, 'exec'))
  File "/mnt/c/Users/pkch/Downloads/mypy/scripts/mypy", line 6, in <module>
    main(__file__)
  File "/mnt/c/Users/pkch/Downloads/mypy/mypy/main.py", line 46, in main
    res = type_check_only(sources, bin_dir, options)
  File "/mnt/c/Users/pkch/Downloads/mypy/mypy/main.py", line 93, in type_check_only
    options=options)
  File "/mnt/c/Users/pkch/Downloads/mypy/mypy/build.py", line 188, in build
    graph = dispatch(sources, manager)
  File "/mnt/c/Users/pkch/Downloads/mypy/mypy/build.py", line 1570, in dispatch
    process_graph(graph, manager)
  File "/mnt/c/Users/pkch/Downloads/mypy/mypy/build.py", line 1806, in process_graph
    process_fresh_scc(graph, prev_scc)
  File "/mnt/c/Users/pkch/Downloads/mypy/mypy/build.py", line 1875, in process_fresh_scc
    graph[id].fix_cross_refs()
  File "/mnt/c/Users/pkch/Downloads/mypy/mypy/build.py", line 1341, in fix_cross_refs
    self.manager.options.quick_and_dirty)
  File "/mnt/c/Users/pkch/Downloads/mypy/mypy/fixup.py", line 22, in fixup_module_pass_one
    node_fixer.visit_symbol_table(tree.names)
  File "/mnt/c/Users/pkch/Downloads/mypy/mypy/fixup.py", line 81, in visit_symbol_table
    self.quick_and_dirty)
  File "/mnt/c/Users/pkch/Downloads/mypy/mypy/fixup.py", line 256, in lookup_qualified_stnode
    assert '.' in head, "Cannot find %s" % (name,)
AssertionError: Cannot find importlib.abc.Loader
(mypy) [pkch@kanto mypy] 2017-04-19 22:15:26 (master)
$

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions