| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
If we have an expression of the form "not instance" then we can recurse and just switch the else and if expressions. We might as well take this opportunity.
We simply check for isinstance when visiting conditionals and correctly push for the if/else expressions, giving them new types only for those particular expressions. After that, the type of the variable being modified returns to its original type.
|
What about isinstance(obj, A) and isinstance(obj2, B) ? |
Sorry, something went wrong.
|
See comment in find_isinstance_check in checker.py). Its not supported by if-statements as far as I'm aware, so I'm not supporting it for if-expressions. I don't mind tackling this, but its a separate issue. Adding this would require modifying find_isinstance_check to be smarter and also returning a Dict[Node, Tuple[Type, Type]] or so. Its kind of tricky, because as you can imagine isinstance(obj, A) and isinstance(obj, B) should resolve obj to whichever is a subclass of the other (or be impossible). |
Sorry, something went wrong.
|
Yeah, multiple insinstance checks is a separate issue (I added #900 for it). |
Sorry, something went wrong.
|
Looks good, thanks for the PR! |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
#806