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: make TypedAttribute printing generic #3490

Merged
merged 2 commits into from
Nov 20, 2024

Conversation

alexarice
Copy link
Collaborator

This currently doesn't really do anything because IntegerAttr is the only TypedAttribute. But after future PRs this will unify the way in which TypedAttribute is printed.

There is a potential worry about circularity here if someone calls print_attribute in print_without_type but I think this would have caused problems anyway

@alexarice alexarice added the core xDSL core (ir, textual format, ...) label Nov 20, 2024
@alexarice alexarice self-assigned this Nov 20, 2024
if isinstance(attribute, TypedAttribute):
attribute.print_without_type(self)
self.print_string(" : ")
self.print_attribute(attribute.parameters[attribute.get_type_index()])
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the line which needs get_type_index to be a classmethod

Copy link

codecov bot commented Nov 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.31%. Comparing base (178e3aa) to head (56e12c0).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3490   +/-   ##
=======================================
  Coverage   90.31%   90.31%           
=======================================
  Files         462      462           
  Lines       58039    58040    +1     
  Branches     5562     5563    +1     
=======================================
+ Hits        52417    52419    +2     
  Misses       4188     4188           
+ Partials     1434     1433    -1     

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


🚨 Try these New Features:

Co-authored-by: Sasha Lopoukhine <superlopuh@gmail.com>
@alexarice alexarice merged commit 0c871d9 into main Nov 20, 2024
15 checks passed
@alexarice alexarice deleted the alexarice/typed-attribute-printing branch November 20, 2024 14:30
EdmundGoodman pushed a commit to EdmundGoodman/xdsl that referenced this pull request Dec 6, 2024
This currently doesn't really do anything because `IntegerAttr` is the
only `TypedAttribute`. But after future PRs this will unify the way in
which `TypedAttribute` is printed.
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.

2 participants