mypy
37ee4323 - Clean-up classes nested in functions (#21478)

Commit
33 days ago
Clean-up classes nested in functions (#21478) Fixes https://github.com/python/mypy/issues/6422 Fixes https://github.com/python/mypy/issues/13024 TBH the current situation is embarrassing. I decided to _finally_ clean this all up and unify various cases. Now we have same simple rules used by all classes, both regular (first three) and magic: * Use the name mangling for everything inside a top-level function. * Do not mangle `defn.name` only `defn.fullname`. * Always store classes nested in functions in global symbol table (using enclosing class was only adding unnecessary complications) * In cases of name mismatch (like `One = NamedTuple("Other", ...)` etc) always use the `var_name` for all purposes. * In cases of inline base classes use different mangling mechanism (since those may be nested in functions as well).
Author
Parents
Loading