Skip to content

fix: resolve generic TO_STRING/TO_WSTRING to the correct monomorphization#1805

Open
ghaith wants to merge 1 commit into
masterfrom
fix/dont_compile_missing_functions
Open

fix: resolve generic TO_STRING/TO_WSTRING to the correct monomorphization#1805
ghaith wants to merge 1 commit into
masterfrom
fix/dont_compile_missing_functions

Conversation

@ghaith

@ghaith ghaith commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

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.

…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>
@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown

Build Artifacts

🐧 Linux

Artifact Link Size
deb-x86_64 Download 38.4 MB
schema Download 0.0 MB
stdlib Download 32.4 MB
plc-x86_64 Download 43.4 MB
deb-aarch64 Download 30.8 MB
plc-aarch64 Download 43.3 MB

From workflow run

🪟 Windows

Artifact Link Size
stdlib.lib Download 4.0 MB
stdlib.dll Download 0.1 MB
plc.exe Download 38.3 MB

From workflow run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant