From 2ebbb1b68e2552831db182003aaa06092b7aeead Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 11 Aug 2026 18:10:24 +0000 Subject: [PATCH 1/3] Initial plan From 25eb4d7a4d4f40a4ad01afa1c440b1e08c681773 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 11 Aug 2026 18:29:01 +0000 Subject: [PATCH 2/3] Ignore unknown warning diagnostic identifiers Co-authored-by: baronfel <573979+baronfel@users.noreply.github.com> --- src/Compiler/Driver/CompilerOptions.fs | 17 ++++++++--------- .../CompilerDirectives/NonStringArgs.fs | 8 ++++++++ 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/Compiler/Driver/CompilerOptions.fs b/src/Compiler/Driver/CompilerOptions.fs index 48574325813..bf6e72f0d95 100644 --- a/src/Compiler/Driver/CompilerOptions.fs +++ b/src/Compiler/Driver/CompilerOptions.fs @@ -791,14 +791,6 @@ let inputFileFlagsFsi (tcConfigB: TcConfigBuilder) = //--------------------------------- let errorsAndWarningsFlags (tcConfigB: TcConfigBuilder) = - let trimFS (s: string) = - if s.StartsWithOrdinal "FS" then s.Substring 2 else s - - let trimFStoInt (s: string) = - match Int32.TryParse(trimFS s) with - | true, n -> Some n - | false, _ -> None - [ CompilerOption( "warnaserror", @@ -816,7 +808,14 @@ let errorsAndWarningsFlags (tcConfigB: TcConfigBuilder) = "warnaserror", tagWarnList, OptionStringListSwitch(fun n switch -> - match trimFStoInt n with + match + GetWarningNumber( + rangeCmdArgs, + WarningDescription.String n, + tcConfigB.langVersion, + WarningNumberSource.CommandLineOption + ) + with | Some n -> let options = tcConfigB.diagnosticsOptions diff --git a/tests/FSharp.Compiler.ComponentTests/CompilerDirectives/NonStringArgs.fs b/tests/FSharp.Compiler.ComponentTests/CompilerDirectives/NonStringArgs.fs index a8b275ab3d5..47e5e5109b9 100644 --- a/tests/FSharp.Compiler.ComponentTests/CompilerDirectives/NonStringArgs.fs +++ b/tests/FSharp.Compiler.ComponentTests/CompilerDirectives/NonStringArgs.fs @@ -143,6 +143,14 @@ match None with None -> () // creates FS0025 - ignored due to flag (Warning 988, Line 3, Col 3, Line 3, Col 3, "Main module of program is empty: nothing will happen when it is run") ] + [] + let ``--warnaserror ignores unknown diagnostic identifiers`` () = + FSharp """ "" """ + |> withOptions ["--warnaserror:NU1605;FS20"] + |> typecheck + |> shouldFail + |> withErrorCode 20 + [] [] From 4c967be0e2fe98ddc2fe26ccbb223a02c0cd9f94 Mon Sep 17 00:00:00 2001 From: Chet Husk Date: Tue, 11 Aug 2026 15:54:05 -0500 Subject: [PATCH 3/3] Add release note for warning code handling Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 9af3efc7-f1b8-4b81-b7be-9e3352348190 --- docs/release-notes/.FSharp.Compiler.Service/11.0.100.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md b/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md index 1058b723552..cafaf68df2d 100644 --- a/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md +++ b/docs/release-notes/.FSharp.Compiler.Service/11.0.100.md @@ -162,6 +162,7 @@ * Direct delegate construction ([PR ##19993](https://github.com/dotnet/fsharp/pull/19993)) ### Changed +* The `--warnaserror` option now ignores unrecognized diagnostic identifiers in warning lists while still applying recognized F# warning codes. ([PR #20246](https://github.com/dotnet/fsharp/pull/20246)) * Improvements in error and warning messages: new error FS3885 when `let!`/`use!` is the final expression in a computation expression; new warning FS3886 when a list literal contains a single tuple element (likely missing `;` separator); improved wording for FS0003, FS0025, FS0039, FS0072, FS0247, FS0597, FS0670, FS3082, and SRTP operator-not-in-scope hints. ([PR #19398](https://github.com/dotnet/fsharp/pull/19398)) * Exception field serialization (`GetObjectData` and field-restoring constructor) is now gated behind `langversion:11` (`LanguageFeature.ExceptionFieldSerializationSupport`). With langversion ≤10, exception codegen is unchanged from pre-#19342 behavior. ([PR #19746](https://github.com/dotnet/fsharp/pull/19746))