@@ -678,11 +678,21 @@ module ProjectOperations =
678678 |> Option.map ( fun s -> s.ToString())
679679 |> Option.defaultValue " "
680680
681+ let filterErrors ( diagnostics : FSharpDiagnostic array ) =
682+ diagnostics
683+ |> Array.filter ( fun diag ->
684+ match diag.Severity with
685+ | FSharpDiagnosticSeverity.Hidden
686+ | FSharpDiagnosticSeverity.Info
687+ | FSharpDiagnosticSeverity.Warning -> false
688+ | FSharpDiagnosticSeverity.Error -> true )
689+
681690 let expectOk parseAndCheckResults _ =
682691 let checkResult = getTypeCheckResult parseAndCheckResults
692+ let errors = filterErrors checkResult.Diagnostics
683693
684- if checkResult.Diagnostics .Length > 0 then
685- failwith $" Expected no errors, but there were some: \n %A {checkResult.Diagnostics }"
694+ if errors .Length > 0 then
695+ failwith $" Expected no errors, but there were some: \n %A {errors }"
686696
687697 let expectSingleWarningAndNoErrors ( warningSubString : string ) parseAndCheckResults _ =
688698 let checkResult = getTypeCheckResult parseAndCheckResults
@@ -880,9 +890,10 @@ let SaveAndCheckProject project checker isExistingProject =
880890 let! snapshot = FSharpProjectSnapshot.FromOptions( options, getFileSnapshot project)
881891
882892 let! results = checker.ParseAndCheckProject( snapshot)
893+ let errors = filterErrors results.Diagnostics
883894
884- if not ( Array.isEmpty results.Diagnostics || project.SkipInitialCheck) then
885- failwith $" Project {project.Name} failed initial check: \n %A {results.Diagnostics }"
895+ if not ( Array.isEmpty errors || project.SkipInitialCheck) then
896+ failwith $" Project {project.Name} failed initial check: \n %A {errors }"
886897
887898 let! signatures =
888899 Async.Sequential
0 commit comments