-
Notifications
You must be signed in to change notification settings - Fork 7
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 monomorphization
pass
#1733
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1733 +/- ##
==========================================
+ Coverage 86.68% 86.72% +0.04%
==========================================
Files 184 186 +2
Lines 33169 34000 +831
Branches 30044 30875 +831
==========================================
+ Hits 28752 29486 +734
- Misses 2765 2845 +80
- Partials 1652 1669 +17
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
This PR contains breaking changes to the public Rust API. cargo-semver-checks summary
|
This reverts commit 703004e.
monomorphization
pass.monomorphization
pass
} | ||
|
||
fn escape_dollar(str: impl AsRef<str>) -> String { | ||
str.as_ref().replace("$", "\\$") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems a bit risky to be sanitising strings ourselves, should we use a library?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are no rules on what names functions are allowed, so sanitising is too strong a word for this.
The worst that can happen is that we end up with non-unique names, which is allowed by HUGR and the docs of monomorphize
.
Surely there is room for a better, well motivated, and principled design. I think that this is the best we can do for now.
If you have specific suggestions I'm happy to change.
@@ -259,6 +279,14 @@ impl DataflowOpTrait for OpaqueOp { | |||
fn signature(&self) -> Cow<'_, Signature> { | |||
Cow::Borrowed(&self.signature) | |||
} | |||
|
|||
fn substitute(&self, subst: &crate::types::Substitution) -> Self { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm surprised this isn't covered, it should be right?
@@ -367,6 +419,26 @@ impl DataflowOpTrait for LoadFunction { | |||
fn static_input(&self) -> Option<EdgeKind> { | |||
Some(EdgeKind::Function(self.func_sig.clone())) | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah there's a lot of substitute code not covered here :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that is addressed in the commit message. We will add proptests in a future PR
Co-authored-by: Seyon Sivarajah <[email protected]>
Co-authored-by: Seyon Sivarajah <[email protected]>
@@ -367,6 +419,26 @@ impl DataflowOpTrait for LoadFunction { | |||
fn static_input(&self) -> Option<EdgeKind> { | |||
Some(EdgeKind::Function(self.func_sig.clone())) | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that is addressed in the commit message. We will add proptests in a future PR
} | ||
|
||
fn escape_dollar(str: impl AsRef<str>) -> String { | ||
str.as_ref().replace("$", "\\$") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are no rules on what names functions are allowed, so sanitising is too strong a word for this.
The worst that can happen is that we end up with non-unique names, which is allowed by HUGR and the docs of monomorphize
.
Surely there is room for a better, well motivated, and principled design. I think that this is the best we can do for now.
If you have specific suggestions I'm happy to change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks :)
Closes #1630
#1772 tracks adding tests for
substitute
.BREAKING CHANGE:
Optrait
gainsSized
andClone
as supertraits and is no longer object safe.BREAKING CHANGE:
DataflowOptrait
gainsSized
as supertrait.BREAKING CHANGE:
DataflowOptrait
has an additional required methodsubstitute
.