Skip to content

Fix NativeAOT execution of printf-formatted interpolated strings - #20778

Open
T-Gro wants to merge 5 commits into
mainfrom
fix/issue-20757
Open

T-Gro wants to merge 5 commits into
mainfrom
fix/issue-20757

Conversation

@T-Gro

@T-Gro T-Gro commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

Fixes #20757

Description

Restore captured printf formatting for interpolation holes so zero-padded timestamps run under NativeAOT. Preserve interpolation fast paths and reject incorrectly typed printf thunks without spurious function-hole warnings.

Checklist

  • Test cases added

  • Performance benchmarks added in case of performance changes

  • Release notes entry updated:

    Please make sure to add an entry with short succinct description of the change as well as link to this pull request to the respective release notes file, if applicable.

    Release notes files:

    • If anything under src/Compiler has been changed, please make sure to make an entry in docs/release-notes/.FSharp.Compiler.Service/<version>.md, where <version> is usually "highest" one, e.g. 42.8.200
    • If language feature was added (i.e. LanguageFeatures.fsi was changed), please add it to docs/release-notes/.Language/preview.md
    • If a change to FSharp.Core was made, please make sure to edit docs/release-notes/.FSharp.Core/<version>.md where version is "highest" one, e.g. 8.0.200.

    Information about the release notes entries format can be found in the documentation.
    Example:

    If you believe that release notes are not necessary for this PR, please add NO_RELEASE_NOTES label to the pull request.

Copilot and others added 3 commits October 13, 2026 11:08
Reuse the existing captured PrintfFormat interpolation pipeline for per-hole printf fallbacks, preserving concat fast paths, original hole/specifier ranges, and evaluation timing. Avoid synthetic format-location notifications so foreground checking retains real arity and source ranges.

Verify #20757 under fixed SDK/Core/ILC options: first parent runs natively, regression merge/current fail with CaptureFinal1<int>, corrected native timestamp emits exactly 01:02:03 with exit 0. Add shared native/JIT formatting, generic/evaluation and separate-library fixtures, captured IL and FCS diagnostic tests. Keep the original native harness warning-strict; only the compatibility executable allows eight proven baseline warning IDs, all visible, with no new warning signatures.

Validation: Release build/pack and Debug/Release compiler builds pass; 67 focused component/IL/diagnostic cases, 15 focused FCS cases, and strict plus compatibility NativeAOT harness pass. Full editor checks pass 74 with 3 unchanged skips. Direct parse/typecheck and non-Claude local expert review pass. Update the 11.0.200 issue-linked release note. No push or remote posting.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Build captured fallback formats directly from the already parsed hole types. Reuse the existing captured constructor pipeline rather than rechecking synthesized sprintf syntax, preserving NativeAOT execution without false FS3884 warnings or redundant per-hole typechecking. Retain function-format and structured-capture regressions and consolidate foreground diagnostic scenarios.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…rgets

Normalize printer state, residue and result for every string-rendering dispatch before parsing interpolation holes. Reject invalid printf thunks with FS0001 instead of capturing them with incompatible unit/string format types. Preserve custom PrintfFormat and FormattableString dispatch.

Add state/residue diagnostic regressions, valid upcast rendering checks, custom-format controls, foreground diagnostic checks and NativeAOT coverage. Clean Release and Debug solution builds pass; Release interpolation/IL tests pass 80, Debug interpolation tests pass 67, editor tests pass 80 with 3 existing skips in each configuration. Fresh native fixtures return exactly Finished and 01:02:03; expert review reports LGTM.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

✅ Release notes checked


✅ Found changes and release notes in following paths:

Change path Release notes path Description
`src/Compiler` docs/release-notes/.FSharp.Compiler.Service/11.0.200.md

Copilot and others added 2 commits October 13, 2026 18:33
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Retain both release-note entries and the validated NativeAOT captured-format correction.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@T-Gro
T-Gro requested a review from abonie October 14, 2026 11:04

This branch has not been deployed

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

Labels

None yet

Projects

Status: New

Development

Successfully merging this pull request may close these issues.

Question about changed behavior of string interpolations in NativeAOT in the .NET 11 rc1 SDK

1 participant