-
-
Couldn't load subscription status.
- Fork 3k
Open
Labels
priority-1-normalrefactoringChanging mypy's internalsChanging mypy's internalssemantic-analyzerProblems that happen during semantic analysisProblems that happen during semantic analysis
Description
While working on #6421 I looked again at logic for storing symbols for local (function- or method-level) classes in prepare_class_def(). The logic is too ad-hoc and needs to be cleaned up. Here are some points that should be fixed:
defn.fullnameandinfo.fullname()should always coincideinfo.fullname()prefix should coincide with the symbol table where the info is actually stored (for serialization)- things should work for double nested classes
- things should work in fine-grained mode
I think the logic should be as following. Consider this example:
class Out:
def meth(self) -> None:
class In:
def meth(self) -> None:
class C: passThe class C should be stored in its local namespace under name 'C'. In addition it should be stored in the namespace of __main__.Out under name 'C@5'. info.fullname() and defn.fullname should be both '__main__.Out.C@5'.
Metadata
Metadata
Assignees
Labels
priority-1-normalrefactoringChanging mypy's internalsChanging mypy's internalssemantic-analyzerProblems that happen during semantic analysisProblems that happen during semantic analysis