GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign up| continue | ||
| # respect explicitly annotated type | ||
| if (isinstance(lval.node, Var) and lval.node.type is not None): | ||
| continue | ||
| lnode = self.current_symbol_table().get(lval.name) | ||
| if lnode is None and self.type is not None: |
The symbol table selection doesn't work correctly. In the case of the the self.<var> = x definitions, the result of current_symbol_table returns the warnings variable the import statement generated when run in the context of the __init__ function. But we actually want to have lnode = self.type.names.get(lval.name). Is there a better way to get the correct symbol table for the lval?
|
I went to dive into this code to try to produce some guidance to give you, and it ended up being that approximately the minimal way for me to figure out what advice to give was to just go do it. (Though probably I /should/ have been able to figure it out looking at it, but...) The issue was that the decision for which symbol table to look in needed to be made in a more principled way than "it wasn't present in the local table". Instead it needs to be made by actually checking whether it is a reference to self or not, so I went and did that. |
|
LG! There are test failures however. |
|
@msullivan Thanks! |
xhochy commentedJan 8, 2020
Fixes #4291
This is only a partial fix. As I'm new to the codebase, I'm unaware of the way an assignment correctly works. Thus also one of the newly added tests still fail. See the inline comment on the code change for the problem.