Honor --nowarn for command-line option warnings#19776
Merged
Merged
Conversation
Contributor
❗ Release notes required
|
Contributor
|
Commit pushed:
|
This comment has been minimized.
This comment has been minimized.
Contributor
|
Note The pull request was not created — a fallback review issue was created instead due to protected file changes: #19781 🤖 LabelOps — Conflict Resolution. Merged
|
Tests demonstrate that --nowarn:N does not suppress warnings emitted during command-line option parsing (e.g. FS0075 for internal/test-only options like --extraoptimizationloops, --typedtree). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ng (#19576) Wrap the logger used to replay delayed command-line diagnostics with GetDiagnosticsLoggerFilteringByScopedNowarn so that --nowarn / --warnaserror / warn-level switches set on the command line are honored for diagnostics captured during option parsing (e.g. FS0075 from internal/test-only flags such as --extraoptimizationloops or --typedtree). The fix is applied both on the success path (fsc.fs main1, line ~586) and on the error/exit paths via the IDiagnosticsLoggerProvider extension method, making it universal across fsc.exe and FSharpChecker.Compile. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The third test added in TDD red phase was speculative (warning numbers didn't match) and outside the scope of sprint 2's DoD. Sprint 2 only required the first two tests (FS0075 for --extraoptimizationloops and --typedtree) to pass. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Introduce a local 'warningCmdLine' helper that consults tcConfigB.diagnosticsOptions via PhasedDiagnostic.AdjustSeverity before forwarding to warning/errorR/informationalWarning. This gives option parsing a second, local line of defense so future 'warning' callsites in CompilerOptions.fs cannot silently bypass --nowarn/--warnaserror even if the commit-time delayed-diagnostics wrapper is missing. - Thread TcConfigBuilder through ParseCompilerOptions (all 6 callers). - Thread TcConfigBuilder through CheckAndReportSourceFileDuplicates. - Route the three cowboy 'warning' callsites in CompilerOptions.fs (reportDeprecatedOption, --test unknown-arg, duplicate source file) through warningCmdLine. - Add a regression test for FS1063 (--test unknown sub-flag). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The emit-time warningCmdLine helper was order-dependent (only worked when --nowarn preceded the triggering option) and introduced a regression with --warnaserror+ (premature abort via errorR incrementing ErrorCount before --nowarn could take effect). Replace with commit-time filtering via GetDiagnosticsLoggerFilteringByScopedNowarn at the two sites in fsc.fs where CapturingDiagnosticsLogger replays captured diagnostics. This correctly applies all --nowarn/--warnaserror settings accumulated during the full option parsing pass. Revert ParseCompilerOptions and CheckAndReportSourceFileDuplicates signatures to their original forms (no TcConfigBuilder parameter needed). Add missing tests: - Baseline tests verifying warnings ARE emitted without --nowarn - --warnaserror+ with --nowarn interaction test Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…serror semantics Add tests identified by multi-model adversarial review: - Reverse-order test (--option before --nowarn) proves commit-time filtering works regardless of argument ordering - --warnaserror+ baseline proving warning is promoted to error - --warnaserror+ with --nowarn proving nowarn takes precedence (global) - --warnaserror:75 with --nowarn:75 documenting that specific warnaserror wins over --nowarn (AdjustSeverity uses localNowarn for specific, warnOff for global) 13 tests total, 0 duplication of test source code. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Triggers both FS0075 and FS1063 simultaneously, suppresses only FS0075 via --nowarn:75, and asserts FS1063 still fires. Catches regressions where filtering accidentally drops all command-line warnings. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…x CI The file was tracked by git as CompilerOptions/Fsc/warn/ (uppercase) while the fsproj and all sibling files use lowercase fsc/. On case-sensitive Linux this caused FS0225 'source file not found'. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Remove type annotation restating what inference provides - Replace code-restating comments with WHY-comments - Add test: --nowarn before --warnaserror+ still suppresses Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
9a40dce to
cdc71fc
Compare
Remove mechanical test duplicates (15→7): drop Theory×3 testing same warn number with different triggers, drop duplicate withNoWarn vs raw --nowarn:N tests, drop redundant order-independence test. Move release notes to 11.0.100.md (VNEXT). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
abonie
approved these changes
May 21, 2026
This was referenced May 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #19576
--nowarnand--warnaserrorare now applied to warnings emitted during command-line option parsing, matching their behavior for all other compiler warnings.