| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
LG, but I have few questions/suggestions.
Sorry, something went wrong.
| o.body.accept(self) | ||
|
|
||
| def visit_class_def(self, o: ClassDef) -> None: | ||
| self.process_definition(o.name) |
There was a problem hiding this comment.
Why do we have enter_scope() for functions but not for classes? A variable defined in a class body will not be visible outside (as a variable, will still be available as an attribute of course)
Sorry, something went wrong.
There was a problem hiding this comment.
Yep, good point. Added enter and exit scope calls (with tests that were failing before)
Sorry, something went wrong.
| [case testUseBeforeDefFunc] | ||
| # flags: --enable-error-code partially-defined --enable-error-code use-before-def | ||
| foo() # E: Name "foo" is used before definition | ||
| def foo(): pass |
There was a problem hiding this comment.
Just in case, could you please add test for classes within functions and vice versa? Also maybe add a test where a variable is defined in a class and then is being red outside of class.
Sorry, something went wrong.
There was a problem hiding this comment.
Added tests.
Sorry, something went wrong.
|
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Previously, we would ignore any class definitions and would fail to detect undefined classes and functions. This updates the logic to handle them.
Closes #686