Skip to content

Reexported imports not tracked properly in fine-grained incremental mode #4512

Closed

Description

@msullivan

We fail to propagate changes when the target of an import changes.

Here, we swap what module a imports foo from, but m.f doesn't get rechecked.

[case testImportSwap]
from a import foo
def f() -> int:
    return foo()

[file a.py]
from b1 import foo
[file a.py.2]
from b2 import foo

[file b1.py]
def foo() -> int:
    return 12
[file b2.py]
def foo() -> str:
    return 'uhoh'
[out]
==
main:3: error: Incompatible return value type (got "str", expected "int")

Same thing if we switch from a importing foo to just defining it.

[case testImportSwap2]
from b import foo
def f() -> int:
    return foo()

[file a.py]
from b import foo
[file a.py.2]
def foo() -> str:
    return 'uhoh'

[file b.py]
def foo() -> int:
    return 12
[out]
==
main:3: error: Incompatible return value type (got "str", expected "int")

Same problem without using from in m.

[case testImportSwap3]
import a
def f() -> int:
    return a.foo()
[file a.py]
from b1 import foo
[file a.py.2]
from b2 import foo

[file b1.py]
def foo() -> int:
    return 12
[file b2.py]
def foo() -> str:
    return 'uhoh'
[out]
==
main:3: error: Incompatible return value type (got "str", expected "int")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions