-
Notifications
You must be signed in to change notification settings - Fork 18
chore!: Require a context when converting types to Hugr #1022
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
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1022 +/- ##
==========================================
- Coverage 92.33% 92.32% -0.02%
==========================================
Files 103 103
Lines 10186 10250 +64
==========================================
+ Hits 9405 9463 +58
- Misses 781 787 +6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Actually, I'm not sure if this is really needed. @acl-cqc maybe hold off on reviewing this until I've thought a bit more about this |
|
@acl-cqc This is ready for review now |
Closes #1035. Tracked PRs: * #1022 * #1034 * #1035 BREAKING CHANGE: All `to_hugr` methods on types, arguments, and parameters now require a `ToHugrContext` BREAKING CHANGE: `CompileableDef.compile_outer` now requires a `ToHugrContext` BREAKING CHANGE: `guppy.hugr_op` now passes the compiler context to the function generating the op BREAKING CHANGE: `CheckedFunctionDef` now implements `MonomorphizableDef` instead of `CompileableDef` BREAKING CHANGE: `CompilerContext.build_compiled_def` now requires an instantiation for the definition's type parameters BREAKING CHANGE: The `ToHugrContext` protocol now requires two additional methods: `type_var_to_hugr` and `const_var_to_hugr` BREAKING CHANGE: `CompilerContext.{compiled, worklist}` and `CompilationEngine.compiled` are now indexed by a tuple of `DefId` and optional `PartiallyMonomorphizedArgs` --------- Co-authored-by: Alan Lawrence <[email protected]>
This is required as a precusor to #1018 to handle monomorphisation: When compiling to Hugr, some bound type variables will need to be replaced with a monotype. We will need access to the compiler context to look this information up.
Instead of requiring the whole compiler context, I added a new
ToHugrContextprotocol in which we can put everything that is needed during the Hugr translation of types (empty for now but will be filled in a subsequent PR). The main motivation for this is that the context needs to change when we go under a binder.BREAKING CHANGE: All
to_hugrmethods on types, arguments, and parameters now require aToHugrContextBREAKING CHAGNE:
CompileableDef.compile_outernow requires aToHugrContextBREAKING CHANGE:
guppy.hugr_opnow passes the compiler context to the function generating the op