Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Compiler/Driver/CompilerDiagnostics.fs
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ type PhasedDiagnostic with
match x.Exception with
| DiagnosticEnabledWithLanguageFeature (_, _, _, enabled) -> enabled
| _ ->
(severity = FSharpDiagnosticSeverity.Info)
(severity = FSharpDiagnosticSeverity.Info && level > 0)
|| (severity = FSharpDiagnosticSeverity.Warning && level >= x.WarningLevel)

/// Indicates if a diagnostic should be reported as an informational
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ module TestCompilerWarningLevel =
[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"warn_level0.fs"|])>]
let ``warn_level0_fs --warn:0`` compilation =
compilation
|> withLangVersionPreview
|> asExe
|> withOptions ["--warn:0"]
|> compileAndRun
|> shouldSucceed
|> withDiagnostics []

[<Theory; Directory(__SOURCE_DIRECTORY__, Includes=[|"warn_level1.fs"|])>]
let ``warn_level1_fs --warn:1 --warnaserror:52`` compilation =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,20 @@
// #NoMT #CompilerOptions

[<NoComparison>]
/// Meh - Informational diagnostics "XML comment is not placed on a valid language element."
type A = int

let x = 10
// Normally a The result of this equality expression has type 'bool' and is implicitly discarded.
x = 20

let mul x y = x * y
// Normally a warning
[<TailCall>]
let rec fact n acc =
if n = 0
then acc
else (fact (n - 1) (mul n acc)) + 23

// Normally a 'Main module of program is empty: nothing will happen when it is run' warning
()