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

core: Add support for typed SSA values in isa #3988

Open
wants to merge 1 commit into
base: math-fehr/stack/2
Choose a base branch
from

Conversation

math-fehr
Copy link
Collaborator

@math-fehr math-fehr commented Feb 28, 2025

`isa(arg, SSAValue[T])` will check that `arg` is an SSA value, and that
its type is `T`.

stack-info: PR: #3988, branch: math-fehr/stack/3
Copy link

codecov bot commented Feb 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.16%. Comparing base (1c59e49) to head (df1b555).

Additional details and impacted files
@@                  Coverage Diff                  @@
##           math-fehr/stack/2    #3988      +/-   ##
=====================================================
+ Coverage              89.99%   90.16%   +0.17%     
=====================================================
  Files                    466      458       -8     
  Lines                  59260    58315     -945     
  Branches                5800     5693     -107     
=====================================================
- Hits                   53330    52581     -749     
+ Misses                  4500     4341     -159     
+ Partials                1430     1393      -37     

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

if origin is SSAValue:
if not isinstance(arg, SSAValue):
return False
arg = cast(SSAValue, arg)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would it make sense to do isa(arg.type, get_args(hint)[0]) here?


assert isa(a, SSAValue)
assert isa(a, SSAValue[IntegerType])
assert not isa(a, SSAValue[StringAttr])
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we have a test with a generic attribute like VectorType[IntegerType] or something.

math-fehr added a commit that referenced this pull request Feb 28, 2025
`isa(arg, SSAValue[T])` will check that `arg` is an SSA value, and that
its type is `T`.

stack-info: PR: #3988, branch: math-fehr/stack/3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core xDSL core (ir, textual format, ...)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants