-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
bugmypy got something wrongmypy got something wrongpriority-0-highsemantic-analyzerProblems that happen during semantic analysisProblems that happen during semantic analysistopic-fine-grained-incremental
Description
Minimized from an example reported by a user at dropbox.
[case testInfiniteLoop]
# Only happens with new analyzer???
# flags: --new-semantic-analyzer
[file a.py]
from b import f
from typing import Callable, TypeVar
F = TypeVar('F', bound=Callable)
def dec(x: F) -> F: return x
@dec
def foo(self):
class A:
@classmethod
def asdf(cls, x: 'A') -> None: pass
@dec
def bar(self):
class B:
@classmethod
def asdf(cls, x: 'B') -> None: pass
f()
[file b.py]
def f() -> int: pass
[file b.py.2]
def f() -> str: pass
[builtins fixtures/classmethod.pyi]
[out]
==
The issue seems to be that if a nested class isn't reprocessed and the toplevel gets reprocessed, it disappears from the symbol table and triggers its dependencies. If the toplevel depends on the nested class, then this can cause ping-ponging where the two nested classes alternate disappearing and reappearing.
The decorator and the method referencing the class are there because the create the needed dependencies.
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrongpriority-0-highsemantic-analyzerProblems that happen during semantic analysisProblems that happen during semantic analysistopic-fine-grained-incremental