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

misc: add pyright ignores for places where it's not going to be happy #3263

Merged
merged 12 commits into from
Oct 9, 2024

Conversation

superlopuh
Copy link
Member

Pyright used to be happy to accept type expressions as types, but is happy no longer. This adds the required pyright ignores to work around this restriction.

Pylance errors: 94 -> 81

@superlopuh superlopuh self-assigned this Oct 8, 2024
@superlopuh superlopuh added the misc Miscellaneous label Oct 8, 2024
Copy link

codecov bot commented Oct 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.94%. Comparing base (11ed2c2) to head (bbedce2).
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3263   +/-   ##
=======================================
  Coverage   89.94%   89.94%           
=======================================
  Files         443      443           
  Lines       55559    55557    -2     
  Branches     8673     8673           
=======================================
  Hits        49973    49973           
+ Misses       4158     4156    -2     
  Partials     1428     1428           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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! I just had one comment in one place


assert not isa(1, Literal["1"])
assert not isa("1", Literal[1])
assert isa("string", Literal["string"]) # pyright: ignore[reportArgumentType]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it the error that Literal is a TypeExpr and not a type?

@@ -474,7 +474,7 @@ def generate_op(self, tblgen_op: TblgenOp, dialect_name: str):
fields[name] = "var_region_def()"
case (True, True):
fields[name] = 'var_region_def("single_block")'
case _:
case _: # pyright: ignore[reportUnnecessaryComparison]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Wait, should we just remove the default case then? We had this just because pyright wasn't happy, but now it is

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep I'll remove the default case with the new pyright, the old one still wants it. I guess I could remove it now and ignore the pyright error on the match case directly, I'll do that quickly.

Base automatically changed from sasha/misc/lint-more to main October 9, 2024 10:22
@superlopuh superlopuh merged commit de770bf into main Oct 9, 2024
14 checks passed
@superlopuh superlopuh deleted the sasha/misc/pyright-ignores branch October 9, 2024 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
misc Miscellaneous
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants