fix: resolve generic TO_STRING/TO_WSTRING to the correct monomorphization (#1805) - #1829
Merged
Angus-Bethke-Bachmann merged 2 commits intoAug 3, 2026
Merged
Conversation
…tion (#1805) When lowering a call to an aggregate-returning generic function, the lowerer reset the call operator to the bare generic name and relied on re-annotation to re-resolve it. For a call whose concrete monomorphization did not exist, that re-resolution ran against the injected aggregate return buffer and bound the call to `<fn>__STRING`, reinterpreting the argument's bytes as a string. For values without an early null byte this read out of bounds and aborted at runtime. Reset the operator to the resolved monomorphization name instead. A generic call whose monomorphization is not declared is now an E048 unresolved-reference error at compile time, consistent with how scalar generics already surface a missing implementation. Also add the TO_STRING__<T> / TO_WSTRING__<T> monomorphizations for the scalar, bit-string, real and date/time types that already ship a typed <T>_TO_STRING / <T>_TO_WSTRING conversion, so TO_STRING/TO_WSTRING work for them. --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com> Co-authored-by: Angus-Bethke-Bachmann <angus.bethke@bachmann.info> (cherry picked from commit 0212611)
Build Artifacts🐧 Linux
From workflow run 🪟 Windows
From workflow run |
volsa
approved these changes
Jul 30, 2026
Angus-Bethke-Bachmann
enabled auto-merge (squash)
August 3, 2026 08:08
Angus-Bethke-Bachmann
disabled auto-merge
August 3, 2026 08:12
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.
Backport of #1805 to
release/1.0.x(clean cherry-pick of 0212611).A generic
TO_STRING/TO_WSTRINGcall whose concrete monomorphization was not declared silently re-resolved to<fn>__STRINGand reinterpreted the argument's bytes, reading out of bounds at runtime. The call operator is now reset to the resolved monomorphization name, so a missing monomorphization surfaces as anE048unresolved-reference error at compile time. Also ships theTO_STRING__<T>/TO_WSTRING__<T>monomorphizations for the types that already provide a typed<T>_TO_STRING/<T>_TO_WSTRINGconversion.Verified on this branch: full unit test suite and full lit suite pass, including the two new
to_stringend-to-end tests.🤖 Generated with Claude Code