Support composite types in Any-typed contexts#677
Merged
MikaelMayer merged 12 commits intomainfrom Mar 26, 2026
Merged
Conversation
fb34ab8 to
bbdfcf4
Compare
Generate composite_to_string_<composite> functions for each composite type. These take a composite parameter so heap parameterization naturally adds heap dependency, preventing unsound referential transparency assumptions for str() calls across heap mutations. Update exception handler translation to type exception variables as Any instead of PythonError composite, and assign them via exception(maybe_except).
bbdfcf4 to
4202941
Compare
MikaelMayer
commented
Mar 26, 2026
This comment was marked as resolved.
This comment was marked as resolved.
a93104d to
079c832
Compare
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Contributor
|
Please remove the extra added files (e.g. LLM review) |
joscoh
previously approved these changes
Mar 26, 2026
Contributor
Author
|
Extracted |
joscoh
previously approved these changes
Mar 26, 2026
joehendrix
reviewed
Mar 26, 2026
Contributor
joehendrix
left a comment
There was a problem hiding this comment.
I think it'd be worth addressing both of these.
thanhnguyen-aws
previously approved these changes
Mar 26, 2026
…te_to_string generation
100003a
joscoh
approved these changes
Mar 26, 2026
joehendrix
approved these changes
Mar 26, 2026
olivier-aws
pushed a commit
that referenced
this pull request
Mar 30, 2026
The pipeline crashes with a type unification error when a composite value flows into an `Any`-typed position (e.g., `str(e)` on an exception object in a `try/except` handler). This PR fixes the issue by: 1. Generating `$composite_to_string_<type>` and `$composite_to_string_any_<type>` functions for each composite type. These take a composite parameter, so heap parameterization naturally adds a `Heap` dependency — preventing the verifier from unsoundly assuming referential transparency for `str()` calls across heap mutations. 2. When `str()` is called on a composite-typed variable (e.g., `str(e)` where `e: PythonError`), the translation emits `$composite_to_string_any_<Type>(e)` instead of `to_string_any(e)`, keeping the composite type and routing through the heap-aware function. Existing tests pass. New test added for try/except with `str(e)` on PythonError.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The pipeline crashes with a type unification error when a composite value flows into an
Any-typed position (e.g.,str(e)on an exception object in atry/excepthandler).This PR fixes the issue by:
Generating
$composite_to_string_<type>and$composite_to_string_any_<type>functions for each composite type. These take a composite parameter, so heap parameterization naturally adds aHeapdependency — preventing the verifier from unsoundly assuming referential transparency forstr()calls across heap mutations.When
str()is called on a composite-typed variable (e.g.,str(e)wheree: PythonError), the translation emits$composite_to_string_any_<Type>(e)instead ofto_string_any(e), keeping the composite type and routing through the heap-aware function.Existing tests pass. New test added for try/except with
str(e)on PythonError.