Skip to content
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

Merged
merged 5 commits into from Jan 12, 2023
Merged

xDSL: Fix several pyright issues #317

merged 5 commits into from Jan 12, 2023

Conversation

webmiche
Copy link
Collaborator

This PR reduces the number of pyright errors to 94.

@webmiche webmiche added the xdsl xdsl framework specific changes label Jan 11, 2023
@codecov
Copy link

codecov bot commented Jan 11, 2023

Codecov Report

Base: 90.95% // Head: 91.07% // Increases project coverage by +0.12% 🎉

Coverage data is based on head (de5afdc) compared to base (66fd1c8).
Patch coverage: 75.00% of modified lines in pull request are covered.

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     
Impacted Files Coverage Δ
xdsl/dialects/builtin.py 81.81% <0.00%> (+0.37%) ⬆️
xdsl/pattern_rewriter.py 70.90% <0.00%> (ø)
xdsl/ir.py 85.02% <78.57%> (-0.03%) ⬇️
xdsl/irdl_mlir_printer.py 92.04% <100.00%> (ø)
xdsl/rewriter.py 78.75% <100.00%> (ø)
tests/xdsl_opt/test_xdsl_opt.py 100.00% <0.00%> (ø)
xdsl/xdsl_opt_main.py 88.43% <0.00%> (+3.14%) ⬆️

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.
📢 Do you have feedback about the report comment? Let us know in this issue.

@tobiasgrosser tobiasgrosser added the hackathon To be tackled at the hackathon label Jan 11, 2023
Copy link
Collaborator

@math-fehr math-fehr left a 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!

@@ -460,7 +456,7 @@ def from_params(

AnyVectorType: TypeAlias = VectorType[Attribute]

_TensorTypeElems = TypeVar("_TensorTypeElems", bound=Attribute, covariant=True)
Copy link
Collaborator

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?

Copy link
Collaborator Author

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!

_UnrankedTensorTypeElems = TypeVar("_UnrankedTensorTypeElems",
bound=Attribute,
covariant=True)
_UnrankedTensorTypeElems = TypeVar("_UnrankedTensorTypeElems", bound=Attribute)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

xdsl/ir.py Outdated Show resolved Hide resolved
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)
Copy link
Collaborator

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted, let's discuss!

Copy link
Collaborator

@math-fehr math-fehr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Thanks

@math-fehr math-fehr merged commit 1887f97 into main Jan 12, 2023
@math-fehr math-fehr deleted the michel/pyright_issues branch January 12, 2023 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hackathon To be tackled at the hackathon xdsl xdsl framework specific changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants