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

feat: add op for creating new/empty list #1729

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

feat: add op for creating new/empty list #1729

wants to merge 2 commits into from

Conversation

acl-cqc
Copy link
Contributor

@acl-cqc acl-cqc commented Nov 29, 2024

Constants cannot refer to type variables, so you can't have a constant for an empty List<T>...

  • Add ListOp::new to handle this
  • Constant-fold it to an empty ListValue if the element type has no type_vars
  • (Most of the PR) add new functions (kept pub(crate) for now) for whether a Type, TypeArg or ExtensionSet contains variables.

I'm a bit, ugh, do we have to do this; when we move to hugr-model, we'll have a better way, so we'll end up redoing this again. Hence I've not written any tests yet, but will do if we think we want this....?

@acl-cqc acl-cqc requested a review from mark-koch November 29, 2024 09:19
Copy link

codecov bot commented Nov 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.38%. Comparing base (fc609a2) to head (82e27ea).
Report is 6 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1729   +/-   ##
=======================================
  Coverage   86.38%   86.38%           
=======================================
  Files         166      166           
  Lines       30063    30063           
  Branches    26975    26975           
=======================================
  Hits        25969    25969           
  Misses       2558     2558           
  Partials     1536     1536           
Flag Coverage Δ
python 92.42% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Copy link
Contributor

@mark-koch mark-koch left a comment

Choose a reason for hiding this comment

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

I think it would be worth doing this, but I don't feel strongly. Also, I'm not super familiar with the discussion around hugr model, so a second opinion might be good.

In case we add the op, we should also implement the llvm lowering

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants