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
xDSL: Fix several pyright issues #317
Conversation
Codecov ReportBase: 90.95% // Head: 91.07% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #317 +/- ##
==========================================
+ Coverage 90.95% 91.07% +0.12%
==========================================
Files 50 50
Lines 7064 7081 +17
Branches 1167 1169 +2
==========================================
+ Hits 6425 6449 +24
+ Misses 396 390 -6
+ Partials 243 242 -1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
17bcb75
to
92798d9
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.
I added some comments, but otherwise that's good progress!
xdsl/dialects/builtin.py
Outdated
@@ -460,7 +456,7 @@ def from_params( | |||
|
|||
AnyVectorType: TypeAlias = VectorType[Attribute] | |||
|
|||
_TensorTypeElems = TypeVar("_TensorTypeElems", bound=Attribute, covariant=True) |
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.
I don't think this is the solution we want.
Since our attributes are immutable, this should be covariant.
I guess you changed this because the constructors need a different type variable, which is contravariant right?
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.
I decided to revert this change for the time being, s.t. we can get this PR merged asap. Let's look at this today!
xdsl/dialects/builtin.py
Outdated
_UnrankedTensorTypeElems = TypeVar("_UnrankedTensorTypeElems", | ||
bound=Attribute, | ||
covariant=True) | ||
_UnrankedTensorTypeElems = TypeVar("_UnrankedTensorTypeElems", bound=Attribute) |
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.
Same here
xdsl/rewriter.py
Outdated
@@ -39,7 +39,7 @@ def replace_op(op: Operation, | |||
if not isinstance(new_ops, list): | |||
new_ops = [new_ops] | |||
if new_results is None: | |||
new_results = [] if len(new_ops) == 0 else new_ops[-1].results | |||
new_results = cast(List[SSAValue | None], new_ops[-1].results) |
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.
What happens here when new_ops
is empty? This was handled before but not anymore.
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.
Reverted, let's discuss!
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.
Nice! Thanks
This PR reduces the number of pyright errors to 94.