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

fix: polymorphic calls #901

Merged
merged 3 commits into from
Apr 2, 2024
Merged

fix: polymorphic calls #901

merged 3 commits into from
Apr 2, 2024

Conversation

acl-cqc
Copy link
Contributor

@acl-cqc acl-cqc commented Mar 27, 2024

  • Store the polymorphic type of the called function in Call node, use for the static input
  • Also store the typeargs, and the cache of the instantiation

BREAKING CHANGE: Call nodes now constructed via try_new function

Copy link

codecov bot commented Mar 27, 2024

Codecov Report

Attention: Patch coverage is 75.75758% with 8 lines in your changes are missing coverage. Please review.

Project coverage is 85.56%. Comparing base (8111375) to head (ee7df6f).

Files Patch % Lines
quantinuum-hugr/src/hugr/validate/test.rs 66.66% 0 Missing and 5 partials ⚠️
quantinuum-hugr/src/ops/dataflow.rs 88.23% 1 Missing and 1 partial ⚠️
quantinuum-hugr/src/builder/build_traits.rs 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #901      +/-   ##
==========================================
- Coverage   85.64%   85.56%   -0.08%     
==========================================
  Files          78       78              
  Lines       14417    14444      +27     
  Branches    14417    14444      +27     
==========================================
+ Hits        12347    12359      +12     
- Misses       1436     1445       +9     
- Partials      634      640       +6     
Flag Coverage Δ
rust 85.56% <75.75%> (-0.08%) ⬇️

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.

@doug-q
Copy link
Collaborator

doug-q commented Mar 28, 2024

An alternative:

  • Call remains as is. i.e. it stores only a FunctionType.
  • The builder inserts a LeafOp::TypeApply if necessary

The advantage of this is simpler call node and keeping type application localised to TypeApply

@acl-cqc
Copy link
Contributor Author

acl-cqc commented Mar 28, 2024 via email

@doug-q
Copy link
Collaborator

doug-q commented Mar 28, 2024

The thing about that is that TypeApply works only on Value edges, not Static ones. When we simplify to "no polymorphic lambdas", TypeApply will disappear - but Call will retain some of its essence (as here).

This makes perfect sense, thank you.

@acl-cqc acl-cqc requested a review from doug-q April 2, 2024 08:19
Copy link
Collaborator

@doug-q doug-q left a comment

Choose a reason for hiding this comment

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

Looks good

@acl-cqc acl-cqc mentioned this pull request Apr 2, 2024
@acl-cqc acl-cqc added this pull request to the merge queue Apr 2, 2024
Merged via the queue into main with commit a2e4d05 Apr 2, 2024
17 of 18 checks passed
@acl-cqc acl-cqc deleted the fix/polymorphic_call branch April 2, 2024 11:22
@github-actions github-actions bot mentioned this pull request Apr 15, 2024
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