From 4094336a95066e7dc36f72e07e96498c84cc8efb Mon Sep 17 00:00:00 2001 From: Charles Roddie Date: Mon, 14 Sep 2026 07:31:02 +0100 Subject: [PATCH 1/5] Use printn for interpolated-string printing where FSharp.Core 11 is available Replace printfn $"..." with printn $"..." in FSharp.Core doc examples, commented-out code, FSharp.Core.UnitTests and SDK-run scripts. Co-Authored-By: Claude Opus 5 (1M context) --- eng/tests/TestSplit.fsx | 4 +- src/Compiler/Checking/NameResolution.fs | 2 +- src/Compiler/CodeGen/IlxGen.fs | 6 +- src/Compiler/Service/SynExpr.fs | 2 +- src/FSharp.Core/array2.fsi | 4 +- src/FSharp.Core/array3.fsi | 4 +- src/FSharp.Core/async.fsi | 60 ++++++------- src/FSharp.Core/eventmodule.fsi | 16 ++-- src/FSharp.Core/observable.fsi | 8 +- src/FSharp.Core/resumable.fs | 4 +- src/FSharp.Core/set.fsi | 88 +++++++++---------- .../Language/coroutines.fsx | 4 +- .../Microsoft.FSharp.Control/AsyncModule.fs | 4 +- .../Microsoft.FSharp.Control/AsyncType.fs | 2 +- .../FSharp.Editor/Common/CancellableTasks.fs | 2 +- 15 files changed, 105 insertions(+), 105 deletions(-) diff --git a/eng/tests/TestSplit.fsx b/eng/tests/TestSplit.fsx index dfb7724142c..a4ba8d18d6e 100644 --- a/eng/tests/TestSplit.fsx +++ b/eng/tests/TestSplit.fsx @@ -165,7 +165,7 @@ let filterArgs = // Output format contract: each line must be "dotnet test --no-build -c Release [filterargs]". // Consumers: Build.ps1 parses via regex, build.sh parses via sed. Keep in sync if changing format. if batchHasComponentAtoms || batch = residualBatch then - printfn $"dotnet test {componentTests} --no-build -c Release {filterArgs}" + printn $"dotnet test {componentTests} --no-build -c Release {filterArgs}" for (proj, _, tag) in otherProjects |> List.filter (fun (_, b, tag) -> b = batch && matchesPlatform tag) do - printfn $"dotnet test {proj} --no-build -c Release" + printn $"dotnet test {proj} --no-build -c Release" diff --git a/src/Compiler/Checking/NameResolution.fs b/src/Compiler/Checking/NameResolution.fs index b755d3f0258..4c7d9541351 100644 --- a/src/Compiler/Checking/NameResolution.fs +++ b/src/Compiler/Checking/NameResolution.fs @@ -3127,7 +3127,7 @@ let rec ResolveLongIdentInTypePrim (ncenv: NameResolver) nenv lookupKind (resInf // * is function type e.g.: // ```fsharp // member x.Prop with - // get () = fun a -> printfn $"{a}" + // get () = fun a -> printn $"{a}" // ``` // which is called like this: obj.Prop 123 if p.IsIndexer then diff --git a/src/Compiler/CodeGen/IlxGen.fs b/src/Compiler/CodeGen/IlxGen.fs index ae028f41cd4..a3a15880de1 100644 --- a/src/Compiler/CodeGen/IlxGen.fs +++ b/src/Compiler/CodeGen/IlxGen.fs @@ -3183,9 +3183,9 @@ and GenExprPreSteps (cenv: cenv) (cgbuf: CodeGenBuffer) eenv expr sequel = match cenv.namedDebugPointsForInlinedCode.TryGetValue({ Range = m; Name = debugPointName }) with | false, _ when String.IsNullOrEmpty(debugPointName) -> CG.EmitDebugPoint cgbuf m | false, _ -> - // printfn $"---- Unfound debug point {debugPointName} at {m}" + // printn $"---- Unfound debug point {debugPointName} at {m}" // for KeyValue(k,v) in cenv.namedDebugPointsForInlinedCode do - // printfn $"{k.Range} , {k.Name} -> {v}" + // printn $"{k.Range} , {k.Name} -> {v}" let others = [ for k in cenv.namedDebugPointsForInlinedCode.Keys do @@ -3200,7 +3200,7 @@ and GenExprPreSteps (cenv: cenv) (cgbuf: CodeGenBuffer) eenv expr sequel = CG.EmitDebugPoint cgbuf m | true, dp -> - // printfn $"---- Found debug point {debugPointName} at {m} --> {dp}" + // printn $"---- Found debug point {debugPointName} at {m} --> {dp}" CG.EmitDebugPoint cgbuf dp GenExpr cenv cgbuf eenv codeExpr sequel diff --git a/src/Compiler/Service/SynExpr.fs b/src/Compiler/Service/SynExpr.fs index ef320e68a97..fbac374736e 100644 --- a/src/Compiler/Service/SynExpr.fs +++ b/src/Compiler/Service/SynExpr.fs @@ -1070,7 +1070,7 @@ module SynExpr = // let x = 3 // ( // let x = 4 - // printfn $"{x}" + // printn $"{x}" // ) // x | SynExpr.Sequential(expr1 = SynExpr.Paren(expr = Is inner); expr2 = expr2), _ when innerBindingsWouldShadowOuter inner expr2 -> diff --git a/src/FSharp.Core/array2.fsi b/src/FSharp.Core/array2.fsi index 6a497f32299..a31602cbe15 100644 --- a/src/FSharp.Core/array2.fsi +++ b/src/FSharp.Core/array2.fsi @@ -253,7 +253,7 @@ module Array2D = /// /// let inputs = array2D [ [ 3; 4 ]; [ 13; 14 ] ] /// - /// inputs |> Array2D.iter (fun v -> printfn $"value = {v}") + /// inputs |> Array2D.iter (fun v -> printn $"value = {v}") /// /// Evaluates to unit and prints /// @@ -277,7 +277,7 @@ module Array2D = /// /// let inputs = array2D [ [ 3; 4 ]; [ 13; 14 ] ] /// - /// inputs |> Array2D.iteri (fun i j v -> printfn $"value at ({i},{j}) = {v}") + /// inputs |> Array2D.iteri (fun i j v -> printn $"value at ({i},{j}) = {v}") /// /// Evaluates to unit and prints /// diff --git a/src/FSharp.Core/array3.fsi b/src/FSharp.Core/array3.fsi index f97ebb9869c..bb5cbd248ef 100644 --- a/src/FSharp.Core/array3.fsi +++ b/src/FSharp.Core/array3.fsi @@ -88,7 +88,7 @@ module Array3D = /// /// let inputs = Array3D.init 2 2 3 (fun i j k -> 100*i + 10*j + k) /// - /// inputs |> Array3D.iter (fun v -> printfn $"value = {v}") + /// inputs |> Array3D.iter (fun v -> printn $"value = {v}") /// /// Evaluates to unit and prints /// @@ -120,7 +120,7 @@ module Array3D = /// /// let inputs = Array3D.init 2 2 3 (fun i j k -> 100*i + 10*j + k) /// - /// inputs |> Array3D.iteri (fun i j k v -> printfn $"value at ({i},{j},{k}) = {v}") + /// inputs |> Array3D.iteri (fun i j k v -> printn $"value at ({i},{j},{k}) = {v}") /// /// Evaluates to unit and prints /// diff --git a/src/FSharp.Core/async.fsi b/src/FSharp.Core/async.fsi index 8f706abf653..b9cf025e11a 100644 --- a/src/FSharp.Core/async.fsi +++ b/src/FSharp.Core/async.fsi @@ -213,8 +213,8 @@ namespace Microsoft.FSharp.Control /// |> Async.Catch /// |> Async.RunSynchronously /// |> function - /// | Choice1Of2 result -> printfn $"Result: {result}" - /// | Choice2Of2 e -> printfn $"Exception: {e}" + /// | Choice1Of2 result -> printn $"Result: {result}" + /// | Choice2Of2 e -> printn $"Exception: {e}" /// /// Prints the returned value of someRiskyBusiness() or the exception if there is one. /// @@ -239,9 +239,9 @@ namespace Microsoft.FSharp.Control /// Async.TryCancelled( /// async { /// do! Async.Sleep(i * 1000) - /// printfn $"{i}" + /// printn $"{i}" /// }, - /// fun oce -> printfn $"Computation Cancelled: {i}") + /// fun oce -> printn $"Computation Cancelled: {i}") /// |> Async.Start /// /// Thread.Sleep(6000) @@ -276,9 +276,9 @@ namespace Microsoft.FSharp.Control /// let primes = [ 2; 3; 5; 7; 11 ] /// for i in primes do /// async { - /// use! holder = Async.OnCancel(fun () -> printfn $"Computation Cancelled: {i}") + /// use! holder = Async.OnCancel(fun () -> printn $"Computation Cancelled: {i}") /// do! Async.Sleep(i * 1000) - /// printfn $"{i}" + /// printn $"{i}" /// } /// |> Async.Start /// @@ -320,7 +320,7 @@ namespace Microsoft.FSharp.Control /// [ for i in primes do /// async { /// do! Async.Sleep(i * 1000) - /// printfn $"{i}" + /// printn $"{i}" /// } /// ] /// @@ -330,9 +330,9 @@ namespace Microsoft.FSharp.Control /// /// Thread.Sleep(6000) /// Async.CancelDefaultToken() - /// printfn $"Tasks Finished: %A{t.Result}" + /// printn $"Tasks Finished: %A{t.Result}" /// with - /// | :? System.AggregateException as ae -> printfn $"Tasks Not Finished: {ae.Message}" + /// | :? System.AggregateException as ae -> printn $"Tasks Not Finished: {ae.Message}" /// /// This will print "2" 2 seconds from start, "3" 3 seconds from start, "5" 5 seconds from start, cease computation and /// then print "Tasks Not Finished: One or more errors occurred. (A task was canceled.)". @@ -353,7 +353,7 @@ namespace Microsoft.FSharp.Control /// for i in primes do /// async { /// do! Async.Sleep(i * 1000) - /// printfn $"{i}" + /// printn $"{i}" /// } /// |> Async.Start /// @@ -417,7 +417,7 @@ namespace Microsoft.FSharp.Control /// do! Async.Sleep 500 // Or any other async activity /// let! v1 = completor1 /// let! v2 = completor2 - /// printfn $"Result: {v1 + v2}" + /// printn $"Result: {v1 + v2}" /// } |> Async.RunSynchronouslyImmediate /// /// Will throw a System.TimeoutException if called with a timeout under 2000, otherwise will print "Result: 3". @@ -451,7 +451,7 @@ namespace Microsoft.FSharp.Control /// do! Async.Sleep(System.Random().Next(1000, 2000)) /// /// if i % 2 > 0 then - /// printfn $"{i}" + /// printn $"{i}" /// return true /// else /// return false @@ -461,7 +461,7 @@ namespace Microsoft.FSharp.Control /// |> Async.StartAsTask /// /// t.Wait() - /// printfn $"%A{t.Result}" + /// printn $"%A{t.Result}" /// /// This will print "3", "5", "7", "11" (in any order) in 1-2 seconds and then [| false; true; true; true; false; true |]. /// @@ -496,7 +496,7 @@ namespace Microsoft.FSharp.Control /// /// return /// if i % 2 > 0 then - /// printfn $"{i}" + /// printn $"{i}" /// true /// else /// false @@ -507,7 +507,7 @@ namespace Microsoft.FSharp.Control /// |> Async.StartAsTask /// /// t.Wait() - /// printfn $"%A{t.Result}" + /// printn $"%A{t.Result}" /// /// This will print "3", "5" (in any order) in 1-2 seconds, and then "7", "11" (in any order) in 1-2 more seconds and then /// [| false; true; true; true; false; true |]. @@ -540,7 +540,7 @@ namespace Microsoft.FSharp.Control /// do! Async.Sleep(System.Random().Next(1000, 2000)) /// /// if i % 2 > 0 then - /// printfn $"{i}" + /// printn $"{i}" /// return true /// else /// return false @@ -552,7 +552,7 @@ namespace Microsoft.FSharp.Control /// |> Async.StartAsTask /// /// t.Wait() - /// printfn $"%A{t.Result}" + /// printn $"%A{t.Result}" /// /// This will print "3", "5", "7", "11" with ~1-2 seconds between them except for pauses where even numbers would be and then /// prints [| false; true; true; true; false; true |]. @@ -596,7 +596,7 @@ namespace Microsoft.FSharp.Control /// |> Async.Choice /// |> Async.RunSynchronously /// |> function - /// | Some (i) -> printfn $"{i}" + /// | Some (i) -> printn $"{i}" /// | None -> printfn "No Result" /// /// Prints one randomly selected odd number in 1-2 seconds. If the list is changed to all even numbers, it will @@ -623,7 +623,7 @@ namespace Microsoft.FSharp.Control /// |> Async.Choice /// |> Async.RunSynchronously /// |> function - /// | Some (i) -> printfn $"{i}" + /// | Some (i) -> printn $"{i}" /// | None -> printfn "No Result" /// /// Will sometimes print one randomly selected odd number, sometimes throw System.Exception("Even numbers not supported: 2"). @@ -715,9 +715,9 @@ namespace Microsoft.FSharp.Control /// /// Async.StartWithContinuations( /// computation, - /// (fun result -> printfn $"Result: {result}"), - /// (fun e -> printfn $"Exception: {e}"), - /// (fun oce -> printfn $"Cancelled: {oce}") + /// (fun result -> printn $"Result: {result}"), + /// (fun e -> printn $"Exception: {e}"), + /// (fun oce -> printn $"Cancelled: {oce}") /// ) /// /// This anonymous function will call someRiskyBusiness() and properly use the provided continuations @@ -804,7 +804,7 @@ namespace Microsoft.FSharp.Control /// | :? System.InvalidOperationException -> /// printfn "unreachable" // will not match: exception is wrapped in AggregateException /// | :? System.AggregateException as e -> - /// printfn $"Caught: {e.InnerException.Message}" + /// printn $"Caught: {e.InnerException.Message}" /// } |> Async.RunSynchronously /// /// Prints Caught: test. The InvalidOperationException branch is not reached because @@ -837,7 +837,7 @@ namespace Microsoft.FSharp.Control /// | :? System.InvalidOperationException -> /// printfn "unreachable" // will not match: exception is wrapped in AggregateException /// | :? System.AggregateException as e -> - /// printfn $"Caught: {e.InnerException.Message}" + /// printn $"Caught: {e.InnerException.Message}" /// } |> Async.RunSynchronously /// /// Prints Caught: test. The InvalidOperationException branch is not reached because @@ -878,7 +878,7 @@ namespace Microsoft.FSharp.Control /// () /// with /// | :? System.InvalidOperationException as e -> - /// printfn $"Caught: {e.Message}" + /// printn $"Caught: {e.Message}" /// | :? System.AggregateException -> /// printfn "unreachable" // will not match: single exception is unwrapped /// } |> Async.RunSynchronously @@ -915,7 +915,7 @@ namespace Microsoft.FSharp.Control /// do! Async.Await t /// with /// | :? System.InvalidOperationException as e -> - /// printfn $"Caught: {e.Message}" + /// printn $"Caught: {e.Message}" /// | :? System.AggregateException -> /// printfn "unreachable" // will not match: single exception is unwrapped /// } |> Async.RunSynchronously @@ -955,7 +955,7 @@ namespace Microsoft.FSharp.Control /// () /// with /// | :? System.InvalidOperationException as e -> - /// printfn $"Caught: {e.Message}" + /// printn $"Caught: {e.Message}" /// | :? System.AggregateException -> /// printfn "unreachable" // will not match: single exception is unwrapped /// } |> Async.RunSynchronously @@ -991,7 +991,7 @@ namespace Microsoft.FSharp.Control /// do! Async.Await vt /// with /// | :? System.InvalidOperationException as e -> - /// printfn $"Caught: {e.Message}" + /// printn $"Caught: {e.Message}" /// | :? System.AggregateException -> /// printfn "unreachable" // will not match: single exception is unwrapped /// } |> Async.RunSynchronously @@ -1410,7 +1410,7 @@ namespace Microsoft.FSharp.Control /// let myTask = MyTask(System.Threading.Tasks.Task.FromResult 42) /// async { /// let! result = Async.Await myTask - /// printfn $"Result: {result}" + /// printn $"Result: {result}" /// } |> Async.RunSynchronously /// /// Prints Result: 42. @@ -1460,7 +1460,7 @@ namespace Microsoft.FSharp.Control /// /// async { /// let! html = fetchConfigured "https://example.com" - /// printfn $"Downloaded {html.Length} chars" + /// printn $"Downloaded {html.Length} chars" /// } |> Async.RunSynchronouslyImmediate /// /// diff --git a/src/FSharp.Core/eventmodule.fsi b/src/FSharp.Core/eventmodule.fsi index e7dff593db4..91de9b0b1ba 100644 --- a/src/FSharp.Core/eventmodule.fsi +++ b/src/FSharp.Core/eventmodule.fsi @@ -32,7 +32,7 @@ module Event = /// /// let result = Event.merge oneSecondTimer fiveSecondsTimer /// - /// result.Subscribe(fun output -> printfn $"Output - {output.SignalTime} ") + /// result.Subscribe(fun output -> printn $"Output - {output.SignalTime} ") /// |> ignore /// /// Console.ReadLine() |> ignore @@ -107,7 +107,7 @@ module Event = /// /// let evenSecondsEvent = Event.filter getEvenSeconds timer /// - /// evenSecondsEvent.Subscribe(fun x -> printfn $"{x} ") + /// evenSecondsEvent.Subscribe(fun x -> printn $"{x} ") /// |> ignore /// /// Console.ReadLine() |> ignore @@ -148,10 +148,10 @@ module Event = /// /// let leftPartition, rightPartition = Event.partition getEvenSeconds timer /// - /// leftPartition.Subscribe(fun x -> printfn $"Left partition: {x.SignalTime}") + /// leftPartition.Subscribe(fun x -> printn $"Left partition: {x.SignalTime}") /// |> ignore /// - /// rightPartition.Subscribe(fun x -> printfn $"Right partition: {x.SignalTime}") + /// rightPartition.Subscribe(fun x -> printn $"Right partition: {x.SignalTime}") /// |> ignore /// /// Console.ReadLine() |> ignore @@ -195,7 +195,7 @@ module Event = /// let evenSplit, printOddNumbers = Event.split bySeconds timer /// /// let printOutput event functionName = - /// Event.add (fun output -> printfn $"{functionName} - Split output: {output}. /// Type: {output.GetType()}") event + /// Event.add (fun output -> printn $"{functionName} - Split output: {output}. /// Type: {output.GetType()}") event /// /// printOutput evenSplit (nameof evenSplit) |> ignore /// @@ -240,7 +240,7 @@ module Event = /// /// let evenSecondsEvent = Event.choose getEvenSeconds timer /// - /// evenSecondsEvent.Subscribe(fun x -> printfn $"{x} ") + /// evenSecondsEvent.Subscribe(fun x -> printn $"{x} ") /// |> ignore /// /// Console.ReadLine() |> ignore @@ -308,7 +308,7 @@ module Event = /// /// let timer = createTimer 1000 /// - /// Event.add (fun (event: Timers.ElapsedEventArgs) -> printfn $"{event.SignalTime} ") timer + /// Event.add (fun (event: Timers.ElapsedEventArgs) -> printn $"{event.SignalTime} ") timer /// /// Console.ReadLine() |> ignore /// @@ -345,7 +345,7 @@ module Event = /// /// let extractPair (pair: Timers.ElapsedEventArgs * Timers.ElapsedEventArgs) = /// let leftPair, rightPair = pair - /// printfn $"(Left): {leftPair.SignalTime} (Right): {rightPair.SignalTime}" + /// printn $"(Left): {leftPair.SignalTime} (Right): {rightPair.SignalTime}" /// /// pairWise.Subscribe(extractPair) |> ignore /// diff --git a/src/FSharp.Core/observable.fsi b/src/FSharp.Core/observable.fsi index fbf68e7c912..922f36dc5fc 100644 --- a/src/FSharp.Core/observable.fsi +++ b/src/FSharp.Core/observable.fsi @@ -41,7 +41,7 @@ module Observable = /// /// let result = Observable.merge observableFirstTimer observableSecondTimer /// - /// result.Subscribe(fun output -> printfn $"Output - {output.SignalTime} ") + /// result.Subscribe(fun output -> printn $"Output - {output.SignalTime} ") /// |> ignore /// /// Console.ReadLine() |> ignore @@ -139,9 +139,9 @@ module Observable = /// let leftPartition, rightPartition = /// Observable.partition isEvenNumber observableNumbers /// - /// leftPartition.Subscribe(fun x -> printfn $"Left partition: {x}") |> ignore + /// leftPartition.Subscribe(fun x -> printn $"Left partition: {x}") |> ignore /// - /// rightPartition.Subscribe(fun x -> printfn $"Right partition: {x}") |> ignore + /// rightPartition.Subscribe(fun x -> printn $"Right partition: {x}") |> ignore /// /// The sample evaluates to: Left partition: 2, 4, Right partition: 1, 3, 5 /// @@ -179,7 +179,7 @@ module Observable = /// let printOutput observable functionName = /// use subscription = /// Observable.subscribe - /// (fun output -> printfn $"{functionName} - Split output: {output}. Type: {output.GetType()}") + /// (fun output -> printn $"{functionName} - Split output: {output}. Type: {output.GetType()}") /// observable /// /// subscription diff --git a/src/FSharp.Core/resumable.fs b/src/FSharp.Core/resumable.fs index 1ace0d12241..2e3d342ef71 100644 --- a/src/FSharp.Core/resumable.fs +++ b/src/FSharp.Core/resumable.fs @@ -415,10 +415,10 @@ module ResumableCode = match __resumableEntry () with | Some contID -> sm.ResumptionPoint <- contID - //if verbose then printfn $"[{sm.Id}] Yield: returning false to indicate yield, contID = {contID}" + //if verbose then printn $"[{sm.Id}] Yield: returning false to indicate yield, contID = {contID}" false | None -> - //if verbose then printfn $"[{sm.Id}] Yield: returning true to indicate post-yield" + //if verbose then printn $"[{sm.Id}] Yield: returning true to indicate post-yield" true //-- RESUMABLE CODE END else diff --git a/src/FSharp.Core/set.fsi b/src/FSharp.Core/set.fsi index 182439ce90d..39263398dab 100644 --- a/src/FSharp.Core/set.fsi +++ b/src/FSharp.Core/set.fsi @@ -29,7 +29,7 @@ type Set<[] 'T when 'T: comparison> = /// /// let sequenceOfNumbers = seq { 1 .. 3 } /// let numbersInSet = Set(sequenceOfNumbers) - /// printfn $"The set is {numbersInSet}" + /// printn $"The set is {numbersInSet}" /// /// /// @@ -48,7 +48,7 @@ type Set<[] 'T when 'T: comparison> = /// /// /// let set = Set.empty.Add(1).Add(1).Add(2) - /// printfn $"The new set is: {set}" + /// printn $"The new set is: {set}" /// /// The sample evaluates to the following output: The new set is: set [1; 2] /// @@ -67,7 +67,7 @@ type Set<[] 'T when 'T: comparison> = /// /// /// let set = Set.empty.Add(1).Add(1).Add(2) - /// printfn $"The new set is: {set}" + /// printn $"The new set is: {set}" /// /// The sample evaluates to the following output: The new set is: set [2] /// @@ -80,7 +80,7 @@ type Set<[] 'T when 'T: comparison> = /// /// /// let set = Set.empty.Add(1).Add(1).Add(2) - /// printfn $"The set has {set.Count} elements" + /// printn $"The set has {set.Count} elements" /// /// The sample evaluates to the following output: The set has 3 elements /// @@ -97,7 +97,7 @@ type Set<[] 'T when 'T: comparison> = /// /// /// let set = Set.empty.Add(2).Add(3) - /// printfn $"Does the set contain 1? {set.Contains(1)}" + /// printn $"Does the set contain 1? {set.Contains(1)}" /// /// The sample evaluates to the following output: Does the set contain 1? false /// @@ -110,7 +110,7 @@ type Set<[] 'T when 'T: comparison> = /// /// /// let set = Set.empty.Add(2).Add(3) - /// printfn $"Is the set empty? {set.IsEmpty}" + /// printn $"Is the set empty? {set.IsEmpty}" /// /// The sample evaluates to the following output: Is the set empty? false /// @@ -129,7 +129,7 @@ type Set<[] 'T when 'T: comparison> = /// /// let set1 = Set.empty.Add(1).Add(2).Add(3) /// let set2 = Set.empty.Add(2).Add(3).Add(4) - /// printfn $"The new set is: {set1 - set2}" + /// printn $"The new set is: {set1 - set2}" /// /// The sample evaluates to the following output: The new set is: set [1] /// @@ -148,7 +148,7 @@ type Set<[] 'T when 'T: comparison> = /// /// let set1 = Set.empty.Add(1).Add(2).Add(3) /// let set2 = Set.empty.Add(2).Add(3).Add(4) - /// printfn $"Output is %A" {set1 + set2}" + /// printn $"Output is %A" {set1 + set2}" /// /// The sample evaluates to the following output: The new set is: set [1; 2; 3; 4] /// @@ -166,7 +166,7 @@ type Set<[] 'T when 'T: comparison> = /// /// let set1 = Set.empty.Add(1).Add(2).Add(3) /// let set2 = Set.empty.Add(1).Add(2).Add(3).Add(4) - /// printfn $"Is {set1} a subset of {set2}? {Set.isSubset set1 set2}" + /// printn $"Is {set1} a subset of {set2}? {Set.isSubset set1 set2}" /// /// The sample evaluates to the following output: Is set [1; 2; 3] a subset of set [1; 2; 3; 4]? true /// @@ -185,7 +185,7 @@ type Set<[] 'T when 'T: comparison> = /// /// let set1 = Set.empty.Add(1).Add(2).Add(3) /// let set2 = Set.empty.Add(1).Add(2).Add(3).Add(4) - /// printfn $"Is {set1} a proper superset of {set2}? {Set.isProperSuperset set1 set2}" + /// printn $"Is {set1} a proper superset of {set2}? {Set.isProperSuperset set1 set2}" /// /// The sample evaluates to the following output: Is set [1; 2; 3] a proper subset of set [1; 2; 3; 4]? true /// @@ -203,7 +203,7 @@ type Set<[] 'T when 'T: comparison> = /// /// let set1 = Set.empty.Add(1).Add(2).Add(3) /// let set2 = Set.empty.Add(1).Add(2).Add(3).Add(4) - /// printfn $"Is {set1} a superset of {set2}? {Set.isSuperset set1 set2}" + /// printn $"Is {set1} a superset of {set2}? {Set.isSuperset set1 set2}" /// /// The sample evaluates to the following output: Is set [1; 2; 3] a superset of set [1; 2; 3; 4]? false /// @@ -222,7 +222,7 @@ type Set<[] 'T when 'T: comparison> = /// /// let set1 = Set.empty.Add(1).Add(2).Add(3) /// let set2 = Set.empty.Add(1).Add(2).Add(3).Add(4) - /// printfn $"Is {set1} a proper superset of {set2}? {Set.isProperSuperset set1 set2}" + /// printn $"Is {set1} a proper superset of {set2}? {Set.isProperSuperset set1 set2}" /// /// The sample evaluates to the following output: Is set [1; 2; 3] a proper superset of set [1; 2; 3; 4]? false /// @@ -235,7 +235,7 @@ type Set<[] 'T when 'T: comparison> = /// /// /// let set = Set.empty.Add(1).Add(2).Add(3) - /// printfn $"MinimumElement: {set.MinimumElement}" + /// printn $"MinimumElement: {set.MinimumElement}" /// /// The sample evaluates to the following output: MinimumElement: 1 /// @@ -248,7 +248,7 @@ type Set<[] 'T when 'T: comparison> = /// /// /// let set = Set.empty.Add(1).Add(2).Add(3) - /// printfn $"MaximumElement: {set.MaximumElement}" + /// printn $"MaximumElement: {set.MaximumElement}" /// /// The sample evaluates to the following output: MaximumElement: 3 /// @@ -332,7 +332,7 @@ module Set = /// /// /// let set = Set.empty.Add(1).Add(1).Add(2) - /// printfn $"The new set is: {set}" + /// printn $"The new set is: {set}" /// /// The sample evaluates to the following output: The new set is: set [1; 2] /// @@ -351,7 +351,7 @@ module Set = /// /// /// let set = Set.empty.Add(2).Add(3) - /// printfn $"Does the set contain 1? {set.Contains(1))}" + /// printn $"Does the set contain 1? {set.Contains(1))}" /// /// The sample evaluates to the following output: Does the set contain 1? false /// @@ -371,7 +371,7 @@ module Set = /// /// let set1 = Set.empty.Add(1).Add(2).Add(3) /// let set2 = Set.empty.Add(1).Add(2).Add(3).Add(4) - /// printfn $"Is {set1} a subset of {set2}? {Set.isSubset set1 set2}" + /// printn $"Is {set1} a subset of {set2}? {Set.isSubset set1 set2}" /// /// The sample evaluates to the following output: Is set [1; 2; 3] a subset of set [1; 2; 3; 4]? true /// @@ -392,7 +392,7 @@ module Set = /// /// let set1 = Set.empty.Add(1).Add(2).Add(3) /// let set2 = Set.empty.Add(1).Add(2).Add(3).Add(4) - /// printfn $"Is {set1} a proper subset of {set2}? {Set.isProperSubset set1 set2}" + /// printn $"Is {set1} a proper subset of {set2}? {Set.isProperSubset set1 set2}" /// /// The sample evaluates to the following output: Is set [1; 2; 3] a proper subset of set [1; 2; 3; 4]? true /// @@ -412,7 +412,7 @@ module Set = /// /// let set1 = Set.empty.Add(1).Add(2).Add(3) /// let set2 = Set.empty.Add(1).Add(2).Add(3).Add(4) - /// printfn $"Is {set1} a superset of {set2}? {Set.isSuperset set1 set2}" + /// printn $"Is {set1} a superset of {set2}? {Set.isSuperset set1 set2}" /// /// The sample evaluates to the following output: Is set [1; 2; 3] a superset of set [1; 2; 3; 4]? false /// @@ -433,7 +433,7 @@ module Set = /// /// let set1 = Set.empty.Add(1).Add(2).Add(3) /// let set2 = Set.empty.Add(1).Add(2).Add(3).Add(4) - /// printfn $"Is {set1} a proper superset of {set2}? {Set.isProperSuperset set1 set2}" + /// printn $"Is {set1} a proper superset of {set2}? {Set.isProperSuperset set1 set2}" /// /// The sample evaluates to the following output: Is set [1; 2; 3] a proper superset of set [1; 2; 3; 4]? false /// @@ -451,7 +451,7 @@ module Set = /// /// /// let set = Set.empty.Add(1).Add(2).Add(3) - /// printfn $"The set has {set.Count} elements" + /// printn $"The set has {set.Count} elements" /// /// The sample evaluates to the following output: The set has 3 elements /// @@ -472,7 +472,7 @@ module Set = /// /// /// let set = Set.empty.Add(1).Add(2).Add(3) - /// printfn $"Does the set contain 1? {Set.exists (fun x -> x = 1) set}" + /// printn $"Does the set contain 1? {Set.exists (fun x -> x = 1) set}" /// /// The sample evaluates to the following output: Does the set contain 1? true /// @@ -492,7 +492,7 @@ module Set = /// /// /// let set = Set.empty.Add(1).Add(2).Add(3).Add(4) - /// printfn $"The set with even numbers is {Set.filter (fun x -> x % 2 = 0) set}" + /// printn $"The set with even numbers is {Set.filter (fun x -> x % 2 = 0) set}" /// /// The sample evaluates to the following output: The set with even numbers is set [2; 4] /// @@ -512,7 +512,7 @@ module Set = /// /// /// let set = Set.empty.Add(1).Add(2).Add(3) - /// printfn $"The set with doubled values is {Set.map (fun x -> x * 2) set}" + /// printn $"The set with doubled values is {Set.map (fun x -> x * 2) set}" /// /// The sample evaluates to the following output: The set with doubled values is set [2; 4; 6] /// @@ -532,9 +532,9 @@ module Set = /// /// /// let set = Set.empty.Add(1).Add(2).Add(3) - /// printfn $"The sum of the set is {Set.fold (+) 0 set}" - /// printfn $"The product of the set is {Set.fold (*) 1 set}" - /// printfn $"The reverse of the set is {Set.fold (fun x y -> y :: x) [] set}" + /// printn $"The sum of the set is {Set.fold (+) 0 set}" + /// printn $"The product of the set is {Set.fold (*) 1 set}" + /// printn $"The reverse of the set is {Set.fold (fun x y -> y :: x) [] set}" /// /// The sample evaluates to the following output: The sum of the set is 6 /// The product of the set is 6 @@ -557,8 +557,8 @@ module Set = /// /// /// let set = Set.empty.Add(1).Add(2).Add(3) - /// printfn $"The sum of the set is {Set.foldBack (+) set 0}" - /// printfn $"The set is {Set.foldBack (fun x acc -> x :: acc) set []}" + /// printn $"The sum of the set is {Set.foldBack (+) set 0}" + /// printn $"The set is {Set.foldBack (fun x acc -> x :: acc) set []}" /// /// The sample evaluates to the following output: The sum of the set is 6 /// The set is [1; 2; 3] @@ -581,7 +581,7 @@ module Set = /// /// /// let set = Set.empty.Add(1).Add(2).Add(3) - /// printfn $"Does the set contain even numbers? {Set.forall (fun x -> x % 2 = 0) set}" + /// printn $"Does the set contain even numbers? {Set.forall (fun x -> x % 2 = 0) set}" /// /// The sample evaluates to the following output: Does the set contain even numbers? false /// @@ -601,7 +601,7 @@ module Set = /// /// let set1 = Set.empty.Add(1).Add(2).Add(3) /// let set2 = Set.empty.Add(2).Add(3).Add(4) - /// printfn $"The intersection of {set1} and {set2} is {Set.intersect set1 set2}" + /// printn $"The intersection of {set1} and {set2} is {Set.intersect set1 set2}" /// /// The sample evaluates to the following output: The intersection of set [1; 2; 3] and set [2; 3; 4] is set [2; 3] /// @@ -648,7 +648,7 @@ module Set = /// /// let set1 = Set.empty.Add(1).Add(2).Add(3) /// let set2 = Set.empty.Add(2).Add(3).Add(4) - /// printfn $"The union of {set1} and {set2} is {(Set.union set1 set2)}" + /// printn $"The union of {set1} and {set2} is {(Set.union set1 set2)}" /// /// The sample evaluates to the following output: The union of set [1; 2; 3] and set [2; 3; 4] is set [1; 2; 3; 4] /// @@ -693,7 +693,7 @@ module Set = /// /// /// let set = Set.empty.Add(2).Add(3) - /// printfn $"Is the set empty? {set.IsEmpty}" + /// printn $"Is the set empty? {set.IsEmpty}" /// /// The sample evaluates to the following output: Is the set empty? false /// @@ -711,7 +711,7 @@ module Set = /// /// /// let set = Set.empty.Add(1).Add(2).Add(3) - /// Set.iter (fun x -> printfn $"The set contains {x}") set + /// Set.iter (fun x -> printn $"The set contains {x}") set /// /// The sample evaluates to the following output: /// The set contains 1 @@ -735,7 +735,7 @@ module Set = /// /// /// let set = Set.empty.Add(1).Add(2).Add(3).Add(4) - /// printfn $"The set with even numbers is {Set.partition (fun x -> x % 2 = 0) set}" + /// printn $"The set with even numbers is {Set.partition (fun x -> x % 2 = 0) set}" /// /// The sample evaluates to the following output: The partitioned sets are: (set [2; 4], set [1; 3]) /// @@ -781,7 +781,7 @@ module Set = /// /// /// let set = Set.empty.Add(1).Add(2).Add(3) - /// printfn $"The set without 1 is {Set.remove 1 set}" + /// printn $"The set without 1 is {Set.remove 1 set}" /// /// The sample evaluates to the following output: The set without 1 is set [2; 3] /// @@ -799,7 +799,7 @@ module Set = /// /// /// let set = Set.empty.Add(1).Add(2).Add(3) - /// printfn $"The min element of {set} is {Set.minElement set}" + /// printn $"The min element of {set} is {Set.minElement set}" /// /// The sample evaluates to the following output: The min element of set [1; 2; 3] is 1 /// @@ -817,7 +817,7 @@ module Set = /// /// /// let set = Set.empty.Add(1).Add(2).Add(3) - /// printfn $"The min element of {set} is {Set.minElement set}" + /// printn $"The min element of {set} is {Set.minElement set}" /// /// The sample evaluates to the following output: The max element of set [1; 2; 3] is 3 /// @@ -835,7 +835,7 @@ module Set = /// /// /// let set = Set.ofList [1, 2, 3] - /// printfn $"The set is {set} and type is {set.GetType().Name}" + /// printn $"The set is {set} and type is {set.GetType().Name}" /// /// The sample evaluates to the following output: The set is set [(1, 2, 3)] and type is "FSharpSet`1" /// @@ -854,7 +854,7 @@ module Set = /// /// let set = Set.empty.Add(1).Add(2).Add(3) /// let list = Set.toList set - /// printfn $"The set is {list} and type is {list.GetType().Name}" + /// printn $"The set is {list} and type is {list.GetType().Name}" /// /// The sample evaluates to the following output: The set is [1; 2; 3] and type is "FSharpList`1" /// @@ -872,7 +872,7 @@ module Set = /// /// /// let set = Set.ofArray [|1, 2, 3|] - /// printfn $"The set is {set} and type is {set.GetType().Name}" + /// printn $"The set is {set} and type is {set.GetType().Name}" /// /// The sample evaluates to the following output: The set is set [(1, 2, 3)] and type is "FSharpSet`1" /// @@ -910,7 +910,7 @@ module Set = /// /// let set = Set.empty.Add(1).Add(2).Add(3) /// let seq = Set.toSeq set - /// printfn $"The set is {set} and type is {seq.GetType().Name}" + /// printn $"The set is {set} and type is {seq.GetType().Name}" /// /// The sample evaluates to the following output: he set is set [1; 2; 3] and type is Microsoft.FSharp.Collections.FSharpSet`1[System.Int32] /// @@ -928,7 +928,7 @@ module Set = /// /// /// let set = Set.ofSeq [1, 2, 3] - /// printfn $"The set is {set} and type is {set.GetType().Name}" + /// printn $"The set is {set} and type is {set.GetType().Name}" /// /// The sample evaluates to the following output: The set is set [(1, 2, 3)] and type is "FSharpSet`1" /// @@ -948,7 +948,7 @@ module Set = /// /// let set1 = Set.empty.Add(1).Add(2).Add(3) /// let set2 = Set.empty.Add(2).Add(3).Add(4) - /// printfn $"The difference of {set1} and {set2} is {Set.difference set1 set2}" + /// printn $"The difference of {set1} and {set2} is {Set.difference set1 set2}" /// /// The sample evaluates to the following output: The difference of set [1; 2; 3] and set [2; 3; 4] is set [1] /// diff --git a/tests/FSharp.Compiler.ComponentTests/Language/coroutines.fsx b/tests/FSharp.Compiler.ComponentTests/Language/coroutines.fsx index 71ffa24f1a6..997ccde2b7e 100644 --- a/tests/FSharp.Compiler.ComponentTests/Language/coroutines.fsx +++ b/tests/FSharp.Compiler.ComponentTests/Language/coroutines.fsx @@ -73,7 +73,7 @@ and [] override cr.MoveNext() = match cr.TailcallTarget with - | None -> //if verbose then printfn $"[{cr.Id}] move" + | None -> //if verbose then printn $"[{cr.Id}] move" MoveNext(&cr.Machine) | Some tg -> match tg.TailcallTarget with @@ -219,7 +219,7 @@ let dumpCoroutine (t: Coroutine) = yieldFromFinalCallCount <- 0 yieldFromCount <- 0 printfn "-----" - while ( //if verbose then printfn $"[{t.Id}] calling t.MoveNext, will resume at {t.ResumptionPoint}"; + while ( //if verbose then printn $"[{t.Id}] calling t.MoveNext, will resume at {t.ResumptionPoint}"; t.MoveNext() not t.IsCompleted) do () // printfn "yield" diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncModule.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncModule.fs index fe9ea95ebfb..a46cafaffc4 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncModule.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncModule.fs @@ -552,7 +552,7 @@ type AsyncModule() = // shows full stack trace from test thread down // Equivalent code under RunSynchronously would be capturing a partial trace from the threadpool thread here, // followed by rethrowing it as a nested exception at the wait site (via AsyncResult.Commit()) - printfn $"STACKTRACE ===\n{e.StackTrace}\n===") + printn $"STACKTRACE ===\n{e.StackTrace}\n===") Assert.Equal(callerThreadId, exceptionOriginThreadId) [] @@ -600,7 +600,7 @@ type AsyncModule() = // Wait for more than one job to start while started < 2 do do! Task.Yield() - printfn $"started jobs: {started}" + printn $"started jobs: {started}" failOnlyOne.Release() |> ignore do! test Assert.Equal(cancelled, started - 1) diff --git a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncType.fs b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncType.fs index d7b19ad4a23..b1701136c83 100644 --- a/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncType.fs +++ b/tests/FSharp.Core.UnitTests/FSharp.Core/Microsoft.FSharp.Control/AsyncType.fs @@ -84,7 +84,7 @@ type AsyncType() = |> Async.Parallel |> run |> Set.ofArray - printfn $"RunSynchronously used {usedThreads.Count} threads. Environment.ProcessorCount is {Environment.ProcessorCount}." + printn $"RunSynchronously used {usedThreads.Count} threads. Environment.ProcessorCount is {Environment.ProcessorCount}." // Some arbitrary large number but in practice it should not use more threads than there are CPU cores. Assert.True(usedThreads.Count < 256, $"RunSynchronously used {usedThreads.Count} threads.") diff --git a/vsintegration/src/FSharp.Editor/Common/CancellableTasks.fs b/vsintegration/src/FSharp.Editor/Common/CancellableTasks.fs index 7520395a084..4d869ba64da 100644 --- a/vsintegration/src/FSharp.Editor/Common/CancellableTasks.fs +++ b/vsintegration/src/FSharp.Editor/Common/CancellableTasks.fs @@ -947,7 +947,7 @@ module CancellableTasks = /// cancellableTask { /// let! cancellationToken = CancellableTask.getCancellationToken() /// do! Task.Delay(i * 1000, cancellationToken) - /// printfn $"{i}" + /// printn $"{i}" /// } /// computation tokenSource.Token |> ignore /// Thread.Sleep(6000) From 10dd73be99c7243a14d20e613b1b3481a9147248 Mon Sep 17 00:00:00 2001 From: Charles Roddie Date: Mon, 14 Sep 2026 07:34:37 +0100 Subject: [PATCH 2/5] Use printn in TheBigFileOfDebugStepping.fsx Co-Authored-By: Claude Opus 5 (1M context) --- .../TheBigFileOfDebugStepping.fsx | 330 +++++++++--------- 1 file changed, 165 insertions(+), 165 deletions(-) diff --git a/tests/walkthroughs/DebugStepping/TheBigFileOfDebugStepping.fsx b/tests/walkthroughs/DebugStepping/TheBigFileOfDebugStepping.fsx index b4cb494c81d..b4ebad34bd4 100644 --- a/tests/walkthroughs/DebugStepping/TheBigFileOfDebugStepping.fsx +++ b/tests/walkthroughs/DebugStepping/TheBigFileOfDebugStepping.fsx @@ -1028,115 +1028,115 @@ module NestedScopesWithShadowing = module ForLoopRegularCode = let testSimpleForEachSeqLoopWithOneStatement inp = for x in inp do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" let testSimpleForEachSeqLoopWithTwoStatements inp = for x in inp do - printfn $"hello, x = {x}" - printfn $"hello, x = {x}" + printn $"hello, x = {x}" + printn $"hello, x = {x}" let testSimpleForEachArrayLoopWithOneStatement (inp:int array) = for x in inp do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" let testSimpleForEachArrayLoopWithTwoStatements (inp:int array) = for x in inp do - printfn $"hello, x = {x}" - printfn $"hello, x = {x}" + printn $"hello, x = {x}" + printn $"hello, x = {x}" let testSimpleForEachListLoopWithOneStatement (inp:int list) = for x in inp do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" let testSimpleForEachListLoopWithTwoStatements (inp:int list) = for x in inp do - printfn $"hello, x = {x}" - printfn $"hello, x = {x}" + printn $"hello, x = {x}" + printn $"hello, x = {x}" let testSimpleForEachStringLoopWithOneStatement (inp:string) = for x in inp do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" let testSimpleForEachStringLoopWithTwoStatements (inp:string) = for x in inp do - printfn $"hello, x = {x}" - printfn $"hello, x = {x}" + printn $"hello, x = {x}" + printn $"hello, x = {x}" let testSimpleForEachIntRangeLoopWithOneStatement (start, stop) = for x in start .. stop do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" let testSimpleForEachIntRangeLoopWithTwoStatements (start, stop) = for x in start .. stop do - printfn $"hello, x = {x}" - printfn $"hello, x = {x}" + printn $"hello, x = {x}" + printn $"hello, x = {x}" let testSimpleForEachIntRangeLoopDownWithOneStatement (start, stop) = for x in stop .. -1 .. start do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" let testSimpleForEachIntRangeLoopDownWithTwoStatements (start, stop) = for x in stop .. -1 .. start do - printfn $"hello, x = {x}" - printfn $"hello, x = {x}" + printn $"hello, x = {x}" + printn $"hello, x = {x}" let testSimpleForEachIntRangeStepLoopWithOneStatement (start, step, stop) = for x in start .. step .. stop do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" let testSimpleForEachIntRangeStepLoopWithTwoStatements (start, step, stop) = for x in start .. step .. stop do - printfn $"hello, x = {x}" - printfn $"hello, x = {x}" + printn $"hello, x = {x}" + printn $"hello, x = {x}" let testSimpleForEachInt64RangeLoopWithOneStatement (start: int64, stop) = for x in start .. stop do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" let testSimpleForEachInt64RangeLoopWithTwoStatements (start: int64, stop) = for x in start .. stop do - printfn $"hello, x = {x}" - printfn $"hello, x = {x}" + printn $"hello, x = {x}" + printn $"hello, x = {x}" let testSimpleForEachInt64RangeLoopDownWithOneStatement (start: int64, stop) = for x in start .. -1L .. stop do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" let testSimpleForEachInt64RangeLoopDownWithTwoStatements (start: int64, stop) = for x in start .. -1L .. stop do - printfn $"hello, x = {x}" - printfn $"hello, x = {x}" + printn $"hello, x = {x}" + printn $"hello, x = {x}" let testSimpleForEachInt64RangeStepLoopWithOneStatement (start: int64, step, stop) = for x in start .. step .. stop do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" let testSimpleForEachInt64RangeStepLoopWithTwoStatements (start: int64, step, stop) = for x in start .. step .. stop do - printfn $"hello, x = {x}" - printfn $"hello, x = {x}" + printn $"hello, x = {x}" + printn $"hello, x = {x}" let testSimpleForEachInt64RangeStepLoopWithConstCount () = for x in 1L .. 3L .. 9L do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" let testSimpleForEachIntLoopWithOneStatement (start, stop) = for x = start to stop do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" let testSimpleForEachIntLoopWithTwoStatements (start, stop) = for x = start to stop do - printfn $"hello, x = {x}" - printfn $"hello, x = {x}" + printn $"hello, x = {x}" + printn $"hello, x = {x}" let testSimpleForEachIntLoopDownWithOneStatement (start, stop) = for x = stop downto start do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" let testSimpleForEachIntLoopDownWithTwoStatements (start, stop) = for x = stop downto start do - printfn $"hello, x = {x}" - printfn $"hello, x = {x}" + printn $"hello, x = {x}" + printn $"hello, x = {x}" testSimpleForEachSeqLoopWithOneStatement [1;2;3] testSimpleForEachSeqLoopWithTwoStatements [1;2;3] @@ -1169,11 +1169,11 @@ module ForLoopRegularCode = #if NETCOREAPP let testSimpleForEachReadOnlySpanLoopWithOneStatement (inp: System.ReadOnlySpan) = [ for x in inp do - printfn $"hello, x = {x}" ] + printn $"hello, x = {x}" ] let testSimpleForEachSpanLoopWithOneStatement (inp: System.Span) = for x in inp do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" testSimpleForEachReadOnlySpanLoopWithOneStatement ("abc".AsSpan()) testSimpleForEachSpanLoopWithOneStatement ([|'a'..'c'|].AsSpan()) @@ -1186,7 +1186,7 @@ module ForLoopInGeneratedList = let testSimpleListEachSeqLoopWithTwoStatements inp = [ for x in inp do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" yield x + 1 ] let testSimpleListEachArrayLoopWithOneStatement (inp:int array) = @@ -1195,7 +1195,7 @@ module ForLoopInGeneratedList = let testSimpleListEachArrayLoopWithTwoStatements (inp:int array) = [ for x in inp do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" yield x + 1 ] let testSimpleListEachListLoopWithOneStatement (inp:int list) = @@ -1206,19 +1206,19 @@ module ForLoopInGeneratedList = [ let y = f () let z = g () for x in inp do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" yield x + y + z ] let testSimpleListEachListLoopWithInitialSequentialExpression f g (inp:int list) = [ f () g () for x in inp do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" yield x + 1 ] let testSimpleListEachListLoopWithTwoStatements (inp:int list) = [ for x in inp do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" yield x + 1 ] let testSimpleListEachStringLoopWithOneStatement (inp:string) = @@ -1227,7 +1227,7 @@ module ForLoopInGeneratedList = let testSimpleListEachStringLoopWithTwoStatements (inp:string) = [ for x in inp do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" yield x ] let testSimpleListEachIntRangeLoopWithOneStatement (start, stop) = @@ -1238,7 +1238,7 @@ module ForLoopInGeneratedList = [ let y = f () let z = g () for x in start .. stop do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" yield x + y + z ] let testSimpleListEachIntRangeLoopWithInitialSequentialExpression f g (start, stop) = @@ -1249,7 +1249,7 @@ module ForLoopInGeneratedList = let testSimpleListEachIntRangeLoopWithTwoStatements (start, stop) = [ for x in start .. stop do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" yield x + 1 ] let testSimpleListEachIntRangeLoopDownWithOneStatement (start, stop) = @@ -1258,7 +1258,7 @@ module ForLoopInGeneratedList = let testSimpleListEachIntRangeLoopDownWithTwoStatements (start, stop) = [ for x in stop .. -1 .. stop do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" yield x + 1 ] let testSimpleListEachIntLoopWithOneStatement (start, stop) = @@ -1267,7 +1267,7 @@ module ForLoopInGeneratedList = let testSimpleListEachIntLoopWithTwoStatements (start, stop) = [ for x = start to stop do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" yield x + 1 ] let testSimpleListEachIntLoopDownWithOneStatement (start, stop) = @@ -1276,7 +1276,7 @@ module ForLoopInGeneratedList = let testSimpleListEachIntLoopDownWithTwoStatements (start, stop) = [ for x = stop downto start do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" yield x + 1 ] testSimpleListEachSeqLoopWithOneStatement [1;2;3] @@ -1307,7 +1307,7 @@ module ForLoopInGeneratedArray = let testSimpleArrayEachSeqLoopWithTwoStatements inp = [| for x in inp do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" yield x + 1 |] let testSimpleArrayEachArrayLoopWithOneStatement (inp:int array) = @@ -1316,7 +1316,7 @@ module ForLoopInGeneratedArray = let testSimpleArrayEachArrayLoopWithTwoStatements (inp:int array) = [| for x in inp do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" yield x + 1 |] let testSimpleArrayEachListLoopWithOneStatement (inp:int list) = @@ -1327,19 +1327,19 @@ module ForLoopInGeneratedArray = [| let y = f () let z = g () for x in inp do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" yield x + y + z |] let testSimpleArrayEachListLoopWithInitialSequentialExpression f g (inp:int array) = [| f () g () for x in inp do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" yield x + 1 |] let testSimpleArrayEachListLoopWithTwoStatements (inp:int list) = [| for x in inp do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" yield x + 1 |] let testSimpleArrayEachStringLoopWithOneStatement (inp:string) = @@ -1348,7 +1348,7 @@ module ForLoopInGeneratedArray = let testSimpleArrayEachStringLoopWithTwoStatements (inp:string) = [| for x in inp do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" yield x |] let testSimpleArrayEachIntRangeLoopWithOneStatement (start, stop) = @@ -1359,7 +1359,7 @@ module ForLoopInGeneratedArray = [| let y = f () let z = g () for x in start .. stop do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" yield x + y + z |] let testSimpleArrayEachIntRangeLoopWithInitialSequentialExpression f g (start, stop) = @@ -1370,7 +1370,7 @@ module ForLoopInGeneratedArray = let testSimpleArrayEachIntRangeLoopWithTwoStatements (start, stop) = [| for x in start .. stop do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" yield x + 1 |] let testSimpleArrayEachIntRangeLoopDownWithOneStatement (start, stop) = @@ -1379,7 +1379,7 @@ module ForLoopInGeneratedArray = let testSimpleArrayEachIntRangeLoopDownWithTwoStatements (start, stop) = [| for x in stop .. -1 .. stop do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" yield x + 1 |] let testSimpleArrayEachIntLoopWithOneStatement (start, stop) = @@ -1388,7 +1388,7 @@ module ForLoopInGeneratedArray = let testSimpleArrayEachIntLoopWithTwoStatements (start, stop) = [| for x = start to stop do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" yield x + 1 |] let testSimpleArrayEachIntLoopDownWithOneStatement (start, stop) = @@ -1397,7 +1397,7 @@ module ForLoopInGeneratedArray = let testSimpleArrayEachIntLoopDownWithTwoStatements (start, stop) = [| for x = stop downto start do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" yield x + 1 |] testSimpleArrayEachSeqLoopWithOneStatement [1;2;3] @@ -1424,12 +1424,12 @@ module ForLoopInGeneratedArray = #if NETCOREAPP let testSimpleListEachReadOnlySpanLoopWithOneStatement (inp: System.ReadOnlySpan) = [ for x in inp do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" yield x + 1 ] let testSimpleListEachSpanLoopWithOneStatement (inp: System.Span) = [ for x in inp do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" yield x + 1 ] testSimpleListEachReadOnlySpanLoopWithOneStatement ("abc".AsSpan()) @@ -1440,15 +1440,15 @@ module ForLoopTaskCode = let testSimpleTaskEachSeqLoopWithOneStatement inp = task { for x in inp do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" return 1 } let testSimpleTaskEachSeqLoopWithTwoStatements inp = task { for x in inp do - printfn $"hello, x = {x}" - printfn $"hello, x = {x}" + printn $"hello, x = {x}" + printn $"hello, x = {x}" return 1 } @@ -1456,105 +1456,105 @@ module ForLoopTaskCode = let testSimpleTaskEachArrayLoopWithOneStatement (inp:int array) = task { for x in inp do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" return 1 } let testSimpleTaskEachArrayLoopWithTwoStatements (inp:int array) = task { for x in inp do - printfn $"hello, x = {x}" - printfn $"hello, x = {x}" + printn $"hello, x = {x}" + printn $"hello, x = {x}" return 1 } let testSimpleTaskEachListLoopWithOneStatement (inp:int list) = task { for x in inp do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" return 1 } let testSimpleTaskEachListLoopWithTwoStatements (inp:int list) = task { for x in inp do - printfn $"hello, x = {x}" - printfn $"hello, x = {x}" + printn $"hello, x = {x}" + printn $"hello, x = {x}" return 1 } let testSimpleTaskEachStringLoopWithOneStatement (inp:string) = task { for x in inp do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" return 1 } let testSimpleTaskEachStringLoopWithTwoStatements (inp:string) = task { for x in inp do - printfn $"hello, x = {x}" - printfn $"hello, x = {x}" + printn $"hello, x = {x}" + printn $"hello, x = {x}" return 1 } let testSimpleTaskEachIntRangeLoopWithOneStatement (start, stop) = task { for x in start .. stop do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" return 1 } let testSimpleTaskEachIntRangeLoopWithTwoStatements (start, stop) = task { for x in start .. stop do - printfn $"hello, x = {x}" - printfn $"hello, x = {x}" + printn $"hello, x = {x}" + printn $"hello, x = {x}" return 1 } let testSimpleTaskEachIntRangeLoopDownWithOneStatement (start, stop) = task { for x in stop .. -1 .. start do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" return 1 } let testSimpleTaskEachIntRangeLoopDownWithTwoStatements (start, stop) = task { for x in stop .. -1 .. start do - printfn $"hello, x = {x}" - printfn $"hello, x = {x}" + printn $"hello, x = {x}" + printn $"hello, x = {x}" return 1 } let testSimpleTaskEachIntLoopWithOneStatement (start, stop) = task { for x = start to stop do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" return 1 } let testSimpleTaskEachIntLoopWithTwoStatements (start, stop) = task { for x = start to stop do - printfn $"hello, x = {x}" - printfn $"hello, x = {x}" + printn $"hello, x = {x}" + printn $"hello, x = {x}" return 1 } let testSimpleTaskEachIntLoopDownWithOneStatement (start, stop) = task { for x = stop downto start do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" return 1 } let testSimpleTaskEachIntLoopDownWithTwoStatements (start, stop) = task { for x = stop downto start do - printfn $"hello, x = {x}" - printfn $"hello, x = {x}" + printn $"hello, x = {x}" + printn $"hello, x = {x}" return 1 } @@ -1579,14 +1579,14 @@ module ForLoopTaskCode = let testSimpleTaskEachReadOnlySpanLoopWithOneStatement (inp: System.ReadOnlySpan) = task { for x in inp do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" return 1 } let testSimpleTaskEachSpanLoopWithOneStatement (inp: System.Span) = task { for x in inp do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" return 1 } @@ -1599,120 +1599,120 @@ module ForLoopSeqCode = let testSimpleSeqEachSeqLoopWithOneStatement inp = seq { for x in inp do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" yield 1 } let testSimpleSeqEachSeqLoopWithTwoStatements inp = seq { for x in inp do - printfn $"hello, x = {x}" - printfn $"hello, x = {x}" + printn $"hello, x = {x}" + printn $"hello, x = {x}" yield 1 } let testSimpleSeqEachArrayLoopWithOneStatement (inp:int array) = seq { for x in inp do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" yield 1 } let testSimpleSeqEachArrayLoopWithTwoStatements (inp:int array) = seq { for x in inp do - printfn $"hello, x = {x}" - printfn $"hello, x = {x}" + printn $"hello, x = {x}" + printn $"hello, x = {x}" yield 1 } let testSimpleSeqEachListLoopWithOneStatement (inp:int list) = seq { for x in inp do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" yield 1 } let testSimpleSeqEachListLoopWithTwoStatements (inp:int list) = seq { for x in inp do - printfn $"hello, x = {x}" - printfn $"hello, x = {x}" + printn $"hello, x = {x}" + printn $"hello, x = {x}" yield 1 } let testSimpleSeqEachStringLoopWithOneStatement (inp:string) = seq { for x in inp do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" yield 1 } let testSimpleSeqEachStringLoopWithTwoStatements (inp:string) = seq { for x in inp do - printfn $"hello, x = {x}" - printfn $"hello, x = {x}" + printn $"hello, x = {x}" + printn $"hello, x = {x}" yield 1 } let testSimpleSeqEachIntRangeLoopWithOneStatement (start, stop) = seq { for x in start .. stop do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" yield 1 } let testSimpleSeqEachIntRangeLoopWithTwoStatements (start, stop) = seq { for x in start .. stop do - printfn $"hello, x = {x}" - printfn $"hello, x = {x}" + printn $"hello, x = {x}" + printn $"hello, x = {x}" yield 1 } let testSimpleSeqEachIntRangeLoopDownWithOneStatement (start, stop) = seq { for x in stop .. -1 .. start do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" yield 1 } let testSimpleSeqEachIntRangeLoopDownWithTwoStatements (start, stop) = seq { for x in stop .. -1 .. stop do - printfn $"hello, x = {x}" - printfn $"hello, x = {x}" + printn $"hello, x = {x}" + printn $"hello, x = {x}" yield 1 } let testSimpleSeqEachIntLoopWithOneStatement (start, stop) = seq { for x = start to stop do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" yield 1 } let testSimpleSeqEachIntLoopWithTwoStatements (start, stop) = seq { for x = start to stop do - printfn $"hello, x = {x}" - printfn $"hello, x = {x}" + printn $"hello, x = {x}" + printn $"hello, x = {x}" yield 1 } let testSimpleSeqEachIntLoopDownWithOneStatement (start, stop) = seq { for x = stop downto start do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" yield 1 } let testSimpleSeqEachIntLoopDownWithTwoStatements (start, stop) = seq { for x = stop downto start do - printfn $"hello, x = {x}" - printfn $"hello, x = {x}" + printn $"hello, x = {x}" + printn $"hello, x = {x}" yield 1 } @@ -1737,14 +1737,14 @@ module ForLoopSeqCode = let testSimpleSeqEachReadOnlySpanLoopWithOneStatement (inp: System.ReadOnlySpan) = seq { for x in inp do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" yield 1 } let testSimpleSeqEachSpanLoopWithOneStatement (inp: System.Span) = seq { for x in inp do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" yield 1 } @@ -1756,15 +1756,15 @@ module ForLoopAsyncCode = let testSimpleAsyncEachSeqLoopWithOneStatement inp = async { for x in inp do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" return 1 } let testSimpleAsyncEachSeqLoopWithTwoStatements inp = async { for x in inp do - printfn $"hello, x = {x}" - printfn $"hello, x = {x}" + printn $"hello, x = {x}" + printn $"hello, x = {x}" return 1 } @@ -1772,105 +1772,105 @@ module ForLoopAsyncCode = let testSimpleAsyncEachArrayLoopWithOneStatement (inp:int array) = async { for x in inp do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" return 1 } let testSimpleAsyncEachArrayLoopWithTwoStatements (inp:int array) = async { for x in inp do - printfn $"hello, x = {x}" - printfn $"hello, x = {x}" + printn $"hello, x = {x}" + printn $"hello, x = {x}" return 1 } let testSimpleAsyncEachListLoopWithOneStatement (inp:int list) = async { for x in inp do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" return 1 } let testSimpleAsyncEachListLoopWithTwoStatements (inp:int list) = async { for x in inp do - printfn $"hello, x = {x}" - printfn $"hello, x = {x}" + printn $"hello, x = {x}" + printn $"hello, x = {x}" return 1 } let testSimpleAsyncEachStringLoopWithOneStatement (inp:string) = async { for x in inp do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" return 1 } let testSimpleAsyncEachStringLoopWithTwoStatements (inp:string) = async { for x in inp do - printfn $"hello, x = {x}" - printfn $"hello, x = {x}" + printn $"hello, x = {x}" + printn $"hello, x = {x}" return 1 } let testSimpleAsyncEachIntRangeLoopWithOneStatement (start, stop) = async { for x in start .. stop do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" return 1 } let testSimpleAsyncEachIntRangeLoopWithTwoStatements (start, stop) = async { for x in start .. stop do - printfn $"hello, x = {x}" - printfn $"hello, x = {x}" + printn $"hello, x = {x}" + printn $"hello, x = {x}" return 1 } let testSimpleAsyncEachIntRangeLoopDownWithOneStatement (start, stop) = async { for x in stop .. -1 .. start do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" return 1 } let testSimpleAsyncEachIntRangeLoopDownWithTwoStatements (start, stop) = async { for x in stop .. -1 .. stop do - printfn $"hello, x = {x}" - printfn $"hello, x = {x}" + printn $"hello, x = {x}" + printn $"hello, x = {x}" return 1 } let testSimpleAsyncEachIntLoopWithOneStatement (start, stop) = async { for x = start to stop do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" return 1 } let testSimpleAsyncEachIntLoopWithTwoStatements (start, stop) = async { for x = start to stop do - printfn $"hello, x = {x}" - printfn $"hello, x = {x}" + printn $"hello, x = {x}" + printn $"hello, x = {x}" return 1 } let testSimpleAsyncEachIntLoopDownWithOneStatement (start, stop) = async { for x = stop downto start do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" return 1 } let testSimpleAsyncEachIntLoopDownWithTwoStatements (start, stop) = async { for x = stop downto start do - printfn $"hello, x = {x}" - printfn $"hello, x = {x}" + printn $"hello, x = {x}" + printn $"hello, x = {x}" return 1 } @@ -1895,14 +1895,14 @@ module ForLoopAsyncCode = let testSimpleAsyncEachReadOnlySpanLoopWithOneStatement (inp: System.ReadOnlySpan) = async { for x in inp do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" return 1 } let testSimpleAsyncEachSpanLoopWithOneStatement (inp: System.Span) = async { for x in inp do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" return 1 } @@ -2144,15 +2144,15 @@ module ForLoopCancellableCode = let testSimpleCancellableEachSeqLoopWithOneStatement inp = cancellable { for x in inp do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" return 1 } let testSimpleCancellableEachSeqLoopWithTwoStatements inp = cancellable { for x in inp do - printfn $"hello, x = {x}" - printfn $"hello, x = {x}" + printn $"hello, x = {x}" + printn $"hello, x = {x}" return 1 } @@ -2160,105 +2160,105 @@ module ForLoopCancellableCode = let testSimpleCancellableEachArrayLoopWithOneStatement (inp:int array) = cancellable { for x in inp do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" return 1 } let testSimpleCancellableEachArrayLoopWithTwoStatements (inp:int array) = cancellable { for x in inp do - printfn $"hello, x = {x}" - printfn $"hello, x = {x}" + printn $"hello, x = {x}" + printn $"hello, x = {x}" return 1 } let testSimpleCancellableEachListLoopWithOneStatement (inp:int list) = cancellable { for x in inp do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" return 1 } let testSimpleCancellableEachListLoopWithTwoStatements (inp:int list) = cancellable { for x in inp do - printfn $"hello, x = {x}" - printfn $"hello, x = {x}" + printn $"hello, x = {x}" + printn $"hello, x = {x}" return 1 } let testSimpleCancellableEachStringLoopWithOneStatement (inp:string) = cancellable { for x in inp do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" return 1 } let testSimpleCancellableEachStringLoopWithTwoStatements (inp:string) = cancellable { for x in inp do - printfn $"hello, x = {x}" - printfn $"hello, x = {x}" + printn $"hello, x = {x}" + printn $"hello, x = {x}" return 1 } let testSimpleCancellableEachIntRangeLoopWithOneStatement (start, stop) = cancellable { for x in start .. stop do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" return 1 } let testSimpleCancellableEachIntRangeLoopWithTwoStatements (start, stop) = cancellable { for x in start .. stop do - printfn $"hello, x = {x}" - printfn $"hello, x = {x}" + printn $"hello, x = {x}" + printn $"hello, x = {x}" return 1 } let testSimpleCancellableEachIntRangeLoopDownWithOneStatement (start, stop) = cancellable { for x in stop .. -1 .. start do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" return 1 } let testSimpleCancellableEachIntRangeLoopDownWithTwoStatements (start, stop) = cancellable { for x in stop .. -1 .. stop do - printfn $"hello, x = {x}" - printfn $"hello, x = {x}" + printn $"hello, x = {x}" + printn $"hello, x = {x}" return 1 } let testSimpleCancellableEachIntLoopWithOneStatement (start, stop) = cancellable { for x = start to stop do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" return 1 } let testSimpleCancellableEachIntLoopWithTwoStatements (start, stop) = cancellable { for x = start to stop do - printfn $"hello, x = {x}" - printfn $"hello, x = {x}" + printn $"hello, x = {x}" + printn $"hello, x = {x}" return 1 } let testSimpleCancellableEachIntLoopDownWithOneStatement (start, stop) = cancellable { for x = stop downto start do - printfn $"hello, x = {x}" + printn $"hello, x = {x}" return 1 } let testSimpleCancellableEachIntLoopDownWithTwoStatements (start, stop) = cancellable { for x = stop downto start do - printfn $"hello, x = {x}" - printfn $"hello, x = {x}" + printn $"hello, x = {x}" + printn $"hello, x = {x}" return 1 } From faaae400da0c36a4c068b13aa7d2e9687eb0dc56 Mon Sep 17 00:00:00 2001 From: Charles Roddie Date: Mon, 14 Sep 2026 07:35:12 +0100 Subject: [PATCH 3/5] Use printn in RemoveUnnecessaryParenthesesTests Co-Authored-By: Claude Opus 5 (1M context) --- .../RemoveUnnecessaryParenthesesTests.fs | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/vsintegration/tests/FSharp.Editor.Tests/CodeFixes/RemoveUnnecessaryParenthesesTests.fs b/vsintegration/tests/FSharp.Editor.Tests/CodeFixes/RemoveUnnecessaryParenthesesTests.fs index 7901df88801..e68e754c981 100644 --- a/vsintegration/tests/FSharp.Editor.Tests/CodeFixes/RemoveUnnecessaryParenthesesTests.fs +++ b/vsintegration/tests/FSharp.Editor.Tests/CodeFixes/RemoveUnnecessaryParenthesesTests.fs @@ -568,12 +568,12 @@ let _ = """ """ - let x = (printfn $"{y}" + let x = (printn $"{y}" 2) in x """, """ - let x = printfn $"{y}" + let x = printn $"{y}" 2 in x """ @@ -1189,21 +1189,21 @@ in x """ let mutable x = 3 - x <- (printfn $"{y}"; 3) + x <- (printn $"{y}"; 3) """, """ let mutable x = 3 - x <- (printfn $"{y}"; 3) + x <- (printn $"{y}"; 3) """ """ let mutable x = 3 - x <- (printfn $"{y}" + x <- (printn $"{y}" 3) """, """ let mutable x = 3 - x <- (printfn $"{y}" + x <- (printn $"{y}" 3) """ @@ -2341,41 +2341,41 @@ let _ = (2 + 2) { return 5 } memberData { // See https://github.com/dotnet/fsharp/issues/16999 """ - (x) < (printfn $"{y}" + (x) < (printn $"{y}" y) """, """ - (x) < (printfn $"{y}" + (x) < (printn $"{y}" y) """ // See https://github.com/dotnet/fsharp/issues/16999 """ - id (x) < (printfn $"{y}" + id (x) < (printn $"{y}" y) """, """ - id (x) < (printfn $"{y}" + id (x) < (printn $"{y}" y) """ // See https://github.com/dotnet/fsharp/issues/16999 """ - id (id (id (x))) < (printfn $"{y}" + id (id (id (x))) < (printn $"{y}" y) """, """ - id (id (id (x))) < (printfn $"{y}" + id (id (id (x))) < (printn $"{y}" y) """ // See https://github.com/dotnet/fsharp/issues/16999 """ - (x) <> z && x < (printfn $"{y}" + (x) <> z && x < (printn $"{y}" y) """, """ - (x) <> z && x < (printfn $"{y}" + (x) <> z && x < (printn $"{y}" y) """ From 5ffd02ecf5d4d6704d5af327964f1dd27c95167e Mon Sep 17 00:00:00 2001 From: Charles Roddie Date: Mon, 14 Sep 2026 07:37:45 +0100 Subject: [PATCH 4/5] Use print instead of printf $ in FSharp.Core doc examples Co-Authored-By: Claude Opus 5 (1M context) --- src/FSharp.Core/eventmodule.fsi | 2 +- src/FSharp.Core/observable.fsi | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/FSharp.Core/eventmodule.fsi b/src/FSharp.Core/eventmodule.fsi index 91de9b0b1ba..33adc44766e 100644 --- a/src/FSharp.Core/eventmodule.fsi +++ b/src/FSharp.Core/eventmodule.fsi @@ -71,7 +71,7 @@ module Event = /// /// let evenSecondsEvent = Event.map transformSeconds timer /// - /// evenSecondsEvent.Subscribe(fun x -> printf $"{x} ") + /// evenSecondsEvent.Subscribe(fun x -> print $"{x} ") /// |> ignore /// /// Console.ReadLine() |> ignore diff --git a/src/FSharp.Core/observable.fsi b/src/FSharp.Core/observable.fsi index 922f36dc5fc..fb7b730fde5 100644 --- a/src/FSharp.Core/observable.fsi +++ b/src/FSharp.Core/observable.fsi @@ -78,7 +78,7 @@ module Observable = /// let multiplyByTwo = fun number -> number * 2 /// let map = Observable.map multiplyByTwo observableNumbers /// - /// map.Subscribe(fun x -> printf $"{x} ") |> ignore + /// map.Subscribe(fun x -> print $"{x} ") |> ignore /// /// The sample will output: 2 4 6 8 10 /// @@ -106,7 +106,7 @@ module Observable = /// let getEvenNumbers = fun number -> number % 2 = 0 /// let map = Observable.filter multiplyByTwo observableNumbers /// - /// map.Subscribe(fun x -> printf $"{x} ") |> ignore + /// map.Subscribe(fun x -> print $"{x} ") |> ignore /// /// The sample will output: 2 4 /// @@ -220,7 +220,7 @@ module Observable = /// /// let map = Observable.choose getOddNumbers observableNumbers /// - /// map.Subscribe(fun x -> printf $"{x} ") |> ignore + /// map.Subscribe(fun x -> print $"{x} ") |> ignore /// /// The sample will output: 1 3 5 /// @@ -270,7 +270,7 @@ module Observable = /// open System.Reactive.Linq /// let numbers = seq { 1..5 } /// let observableNumbers = Observable.ToObservable numbers - /// let multiplyByTwo = fun number -> printf $"{number * 2} " + /// let multiplyByTwo = fun number -> print $"{number * 2} " /// Observable.add multiplyByTwo observableNumbers /// /// The sample evaluates to: 2 4 6 8 10 @@ -321,7 +321,7 @@ module Observable = /// /// let pairWise = Observable.pairwise observableNumbers /// - /// pairWise.Subscribe(fun pair -> printf $"{pair} ") + /// pairWise.Subscribe(fun pair -> print $"{pair} ") /// |> ignore /// /// The sample evaluates to: (1, 2), (2, 3), (3, 4), (4, 5) From d0bc46ee9555a4da4de4b462b1610c219b5af680 Mon Sep 17 00:00:00 2001 From: Charles Roddie Date: Mon, 14 Sep 2026 07:43:39 +0100 Subject: [PATCH 5/5] Remove redundant sprintf before interpolated string Co-Authored-By: Claude Opus 5 (1M context) --- .../FSharpChecker/TransparentCompiler.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/FSharp.Compiler.ComponentTests/FSharpChecker/TransparentCompiler.fs b/tests/FSharp.Compiler.ComponentTests/FSharpChecker/TransparentCompiler.fs index 33ac7992e14..af4a0f6f8de 100644 --- a/tests/FSharp.Compiler.ComponentTests/FSharpChecker/TransparentCompiler.fs +++ b/tests/FSharp.Compiler.ComponentTests/FSharpChecker/TransparentCompiler.fs @@ -602,7 +602,7 @@ let Fuzzing signatureFiles = let fileCount = 30 let maxDepsPerFile = 3 - let fileName i = sprintf $"F%03d{i}" + let fileName i = $"F%03d{i}" //let extraCode = __SOURCE_DIRECTORY__ ++ ".." ++ ".." ++ ".." ++ "src" ++ "Compiler" ++ "Utilities" ++ "EditDistance.fs" |> File.ReadAllLines |> Seq.skip 5 |> String.concat "\n" let extraCode = ""