You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems like we could remove the special handling of module references and other special node kinds in SymbolTableNode so that we could remove the kind attribute and replace it with a scope attribute, with only 3 possible values, corresponding to the current kinds LDEF, GDEF and MDEF. We'd create new SymbolNode subclasses for some of the node kinds. For module references we can perhaps just use a MypyFile target node as a marker. We could move some attributes that are specific to type aliases to live in the new SymbolNode subclass.
Type aliases are quite complicated (due to several corner cases). I tried to make some simplifications recently. It seems to me that we can introduce a dedicated SybmolNode (like Var or TypeInfo) and deprecate type_override and friends and just point .node to this new symbol node. This is major refactoring, but I think it may help.
Actually it looks like having a dedicated ModuleRef symbol node will solve #3500 and other long standing problems with conditional imports and imports in try: ... except: .... We can have something like this:
Activity
ilevkivskyi commentedon Oct 9, 2017
Actually it looks like having a dedicated
ModuleRefsymbol node will solve #3500 and other long standing problems with conditional imports and imports intry: ... except: .... We can have something like this:and then give precise types on attribute access. (This may also simplify creating module aliases.)