fix: resolve generic TO_STRING/TO_WSTRING to the correct monomorphization#1805
Open
ghaith wants to merge 1 commit into
Open
fix: resolve generic TO_STRING/TO_WSTRING to the correct monomorphization#1805ghaith wants to merge 1 commit into
ghaith wants to merge 1 commit into
Conversation
…tion 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>
Build Artifacts🐧 Linux
From workflow run 🪟 Windows
From workflow run |
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.
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__ / TO_WSTRING__ monomorphizations for the scalar, bit-string, real and date/time types that already ship a typed _TO_STRING / _TO_WSTRING conversion, so TO_STRING/TO_WSTRING work for them.