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

api: add generic parameter to attribute constraint #2889

Merged
merged 2 commits into from
Jul 16, 2024

Conversation

superlopuh
Copy link
Member

PR 1/2 to make the Pylance errors in operation definitions go away.

The main idea is for the constraint type to carry the upper bound of the Attribute types that will pass verification. It is not guaranteed to be a strict upper bound.

Pyright errors: 489.

@superlopuh superlopuh added the API Related to changes regarding API of constructs label Jul 16, 2024
@superlopuh superlopuh self-assigned this Jul 16, 2024
Copy link

codecov bot commented Jul 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.92%. Comparing base (75b78ec) to head (c8d743a).
Report is 7 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2889      +/-   ##
==========================================
+ Coverage   89.85%   89.92%   +0.06%     
==========================================
  Files         399      401       +2     
  Lines       50171    50340     +169     
  Branches     7755     7778      +23     
==========================================
+ Hits        45083    45266     +183     
+ Misses       3860     3847      -13     
+ Partials     1228     1227       -1     

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

Comment on lines +9 to +11
def isattr(
arg: Any, hint: type[AttributeInvT] | GenericAttrConstraint[AttributeInvT]
) -> TypeGuard[AttributeInvT]:
Copy link
Collaborator

Choose a reason for hiding this comment

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

can I has docstring?

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 like where this is going.
Thanks for doing the unicorn's work 🙏

@superlopuh superlopuh merged commit ff314f8 into main Jul 16, 2024
9 checks passed
@superlopuh superlopuh deleted the sasha/irdl/typed-constraints/init branch July 16, 2024 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Related to changes regarding API of constructs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants