-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Minor changes to improve the type annotations #53
Conversation
The region change, and the builder change makes sense. |
Latest version of PyCharm (2021.3.2 Professional Edition) and Python 3.9. I will try to reimport the project and see if it makes a difference. |
I think it might be related to the isinstance |
That the first of your examples works is expected, as you have an explicit type annotation in the first line. The "type narrowing" that Does this PR fixes this in your IDE as well? |
... hmm maybe it is just disabling all checking and reverting to the |
I think it's the case, since we don't provide any information about the resulting type of |
I think the type var that we currently have (before this PR) is modelling the type correctly. |
I am trying to see what |
Yeah, what we had before should be correct according to PEP. Though PyCharm seems to be buggy because of the decorator/TypeVar I think. I'm trying to find a minimum reproducer. |
I've made some experiments, and I'm realizing that in fact, nothing was working in the first place. |
Well, I abandon, I have no idea on how to fix this bug. I would suggest to add your changes, since they at least seem to not give annoying warnings, and that they seem to provide the right suggestions somehow! |
These two changes improve the usage of xDSL in PyCharm.
RegionDef
a subclass ofRegion
allowsop
andops
(and other properties and methods of Regions) to show up in the autocomplete menu.Before:
After:
TypeVar
in theirdl_op_definition
significantly improves type checking experience in PyCharm. (I don't understand why!).Before, the IDE doesn't see that
func_def
is of typeFuncDef
:After, it now sees this correctly: