-
Notifications
You must be signed in to change notification settings - Fork 80
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
core: Add shorthand type for types that can be converted to IRDL #3836
Conversation
stack-info: PR: #3836, branch: math-fehr/stack/2
d3123ea
to
e30ef17
Compare
a0bed84
to
2c7e966
Compare
There was a lot of inconsistencies in the typing of functions that are using the type to constraint conversion. Having a shorthand makes this more explicit. stack-info: PR: #3836, branch: math-fehr/stack/2
e30ef17
to
5bc7c8d
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3836 +/- ##
==========================================
- Coverage 91.26% 91.26% -0.01%
==========================================
Files 465 465
Lines 57911 57920 +9
Branches 5578 5579 +1
==========================================
+ Hits 52851 52858 +7
- Misses 3634 3635 +1
- Partials 1426 1427 +1 ☔ View full report in Codecov by Sentry. |
@@ -93,7 +93,9 @@ def isa(arg: Any, hint: "TypeForm[_T]") -> TypeGuard[_T]: | |||
from xdsl.irdl import GenericData, irdl_to_attr_constraint | |||
|
|||
if (origin is not None) and issubclass(origin, GenericData | ParametrizedAttribute): | |||
constraint = irdl_to_attr_constraint(hint) | |||
constraint = irdl_to_attr_constraint( | |||
hint # pyright: ignore[reportArgumentType] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this? what's the error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pyright cannot understand that hint
is either a GenericData
or a ParametrizedAttribute
. That's because the typing we deduce for origin
doesn't spread to hint
.
There was a lot of inconsistencies in the typing of functions that are using the type to constraint conversion. Having a shorthand makes this more explicit. stack-info: PR: #3836, branch: math-fehr/stack/2
There was a lot of inconsistencies in the typing of functions that are using the type to constraint conversion. Having a shorthand makes this more explicit. stack-info: PR: #3836, branch: math-fehr/stack/2
5bc7c8d
to
d30b321
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pyright errors seem to suggest a missing default value on the UnrankedMemrefType
(Will need to rebase past Memref
-> MemRef
(sorry)) generic
There was a lot of inconsistencies in the typing of functions that are using the type to constraint conversion. Having a shorthand makes this more explicit. stack-info: PR: #3836, branch: math-fehr/stack/2
d30b321
to
763d108
Compare
There was a lot of inconsistencies in the typing of functions that are using the type to constraint conversion. Having a shorthand makes this more explicit. stack-info: PR: #3836, branch: math-fehr/stack/2
There was a lot of inconsistencies in the typing of functions that are using the type to constraint conversion. Having a shorthand makes this more explicit. stack-info: PR: #3836, branch: math-fehr/stack/2
763d108
to
c6cc4a9
Compare
This includes default to AttributeInvT and AttributeCovT. stack-info: PR: #3835, branch: math-fehr/stack/1
There was a lot of inconsistencies in the typing of functions that are using the type to constraint conversion. Having a shorthand makes this more explicit. stack-info: PR: #3836, branch: math-fehr/stack/2
c6cc4a9
to
5bcfd9e
Compare
There was a lot of inconsistencies in the typing of functions that are using the type to constraint conversion. Having a shorthand makes this more explicit. stack-info: PR: #3836, branch: math-fehr/stack/2
5bcfd9e
to
55d2296
Compare
Stacked PRs:
core: Add shorthand type for types that can be converted to IRDL
There was a lot of inconsistencies in the typing of functions that are
using the type to constraint conversion. Having a shorthand makes this
more explicit.