Skip to content

Cleanup: use print/printn for simple string literals and drop redundant sprintf - #20544

Open
charlesroddie wants to merge 2 commits into
dotnet:mainfrom
charlesroddie:simple-printf-literals
Open

charlesroddie wants to merge 2 commits into
dotnet:mainfrom
charlesroddie:simple-printf-literals

Conversation

@charlesroddie

Copy link
Copy Markdown
Contributor

Follow-up to #20542, for format strings with no holes.

  • printfn "..."printn "..." and printf "..."print "..." where the referenced FSharp.Core has them
  • sprintf "...""..." (no FSharp.Core dependency, so compiler code is included)
  • Fixes Array/List/Seq iteri doc examples that used printfn "{i}: {v}" without $

Changed

  • FSharp.Core XML doc examples (async, fslib-extra-pervasives, array, list, seq)
  • Commented-out code in the compiler and coroutines.fsx
  • FSharp.Core.UnitTests (always references the FSharp.Core project)
  • TheBigFileOfDebugStepping.fsx, docs/debug-emit.md
  • SDK-run scripts: codingConventions.fsx, identifierAnalysisByType.fsx, ExtractTimingsFromBinlog.fsx, pick-insert-line.fsx
  • RemoveUnnecessaryParenthesesTests (continuation lines re-indented where offside alignment depended on name length)
  • sprintf removed in TypedTree.fs ToString overrides, TestLib.Utils.fs, attributes/test.fsx, topinit/generate.fsx

Not changed

  • Compiler and FSharp.Compiler.Service.slnx project code using printfn/printf: builds against the shipped FSharp.Core 10.0.101, which lacks print/printn.
  • Test source compiled at test time, compat test projects and benchmarks.
  • sprintf "Hello" = "Hello" in libtest (prevents constant folding) and EditorTests.fs format-string range tests.
  • Tutorial.fsx project template: users may build against an older FSharp.Core.

🤖 Generated with Claude Code

charlesroddie and others added 2 commits September 14, 2026 08:05
Replace printfn/printf "literal" with printn/print where FSharp.Core 11
is available, remove sprintf around literals with no format specifiers,
and fix doc examples missing the $ on interpolated strings.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

❗ Release notes required

You can open this PR in browser to add release notes: open in github.dev

@charlesroddie,

Caution

No release notes found for the changed paths (see table below).

Please make sure to add an entry with an informative description of the change as well as link to this pull request, issue and language suggestion if applicable. Release notes for this repository are based on Keep A Changelog format.

The following format is recommended for this repository:

`* . (PR #XXXXX)`

See examples in the files, listed in the table below or in th full documentation at https://fsharp.github.io/fsharp-compiler-docs/release-notes/About.html.

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

Change path Release notes path Description
`src/FSharp.Core` docs/release-notes/.FSharp.Core/11.0.100.md No release notes found or release notes format is not correct
`src/Compiler` docs/release-notes/.FSharp.Compiler.Service/11.0.100.md No release notes found or release notes format is not correct

@charlesroddie charlesroddie changed the title Use print/printn for simple string literals and drop redundant sprintf Cleanup: use print/printn for simple string literals and drop redundant sprintf Sep 14, 2026
@charlesroddie
charlesroddie marked this pull request as ready for review September 14, 2026 08:16
@charlesroddie
charlesroddie requested a review from a team as a code owner September 14, 2026 08:16
@github-actions github-actions Bot added ⚠️ Affects-Design-Time Tooling check: PR touches type providers or dependency manager ⚠️ Affects-Test-Tooling Tooling check: PR touches test framework infrastructure ⚠️ Affects-Compiler-Output Tooling check: PR touches IL emission or codegen ⚠️ Affects-Agent-Config Tooling check: PR modifies AI agent instructions or workflows ⚠️ Affects-Bootstrap Tooling check: PR touches compiler bootstrap chain ⚠️ Affects-Build-Infra Tooling check: PR touches build infrastructure labels Sep 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔍 Tooling Safety Check — Affects-Agent-Config, Affects-Bootstrap, Affects-Build-Infra, Affects-Compiler-Output, Affects-Design-Time, Affects-Test-Tooling
Affects-Agent-Config: Modifies release-notes skill script.
Affects-Bootstrap: Modifies compiler and FSharp.Core sources.
Affects-Build-Infra: Modifies build and repository scripts.
Affects-Compiler-Output: Modifies checking, optimization, and typed-tree code.
Affects-Design-Time: Modifies compiler-service and VS integration code.
Affects-Test-Tooling: Modifies test scripts and test utilities.

Generated by PR Tooling Safety Check · gpt56 944.5K ·

@T-Gro T-Gro left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 🕵️ LGTM

@github-project-automation github-project-automation Bot moved this from New to In Progress in F# Compiler and Tooling Sep 14, 2026
@T-Gro T-Gro added the AI-reviewed PR reviewed by AI review council label Sep 14, 2026
@T-Gro
T-Gro self-requested a review September 14, 2026 14:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

⚠️ Affects-Agent-Config Tooling check: PR modifies AI agent instructions or workflows ⚠️ Affects-Bootstrap Tooling check: PR touches compiler bootstrap chain ⚠️ Affects-Build-Infra Tooling check: PR touches build infrastructure ⚠️ Affects-Compiler-Output Tooling check: PR touches IL emission or codegen ⚠️ Affects-Design-Time Tooling check: PR touches type providers or dependency manager ⚠️ Affects-Test-Tooling Tooling check: PR touches test framework infrastructure AI-reviewed PR reviewed by AI review council

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

2 participants