Skip to content

Commit

Permalink
not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
majocha committed Feb 4, 2024
1 parent c793bfa commit d862d45
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 41 deletions.
25 changes: 0 additions & 25 deletions src/Compiler/Facilities/DiagnosticsLogger.fs
Original file line number Diff line number Diff line change
Expand Up @@ -375,31 +375,6 @@ type CapturingDiagnosticsLogger(nm, ?eagerFormat) =
let errors = diagnostics.ToArray()
errors |> Array.iter diagnosticsLogger.DiagnosticSink

type ConcurrentCapturingDiagnosticsLogger(nm, ?eagerFormat) =
inherit DiagnosticsLogger(nm)
let mutable errorCount = 0
let diagnostics = System.Collections.Concurrent.ConcurrentQueue()

override _.DiagnosticSink(diagnostic, severity) =
let diagnostic =
match eagerFormat with
| None -> diagnostic
| Some f -> f diagnostic

if severity = FSharpDiagnosticSeverity.Error then
Interlocked.Increment &errorCount |> ignore

diagnostics.Enqueue(diagnostic, severity)

override _.ErrorCount = errorCount

member _.Diagnostics = diagnostics |> Seq.toList

member _.CommitDelayedDiagnostics(diagnosticsLogger: DiagnosticsLogger) =
// Eagerly grab all the errors and warnings from the mutable collection
let errors = diagnostics.ToArray()
errors |> Array.iter diagnosticsLogger.DiagnosticSink

/// Type holds thread-static globals for use by the compiler.
type DiagnosticsAsyncState =
static let buildPhase = new AsyncLocal<BuildPhase voption>()
Expand Down
17 changes: 1 addition & 16 deletions src/Compiler/Facilities/DiagnosticsLogger.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -226,21 +226,6 @@ type CapturingDiagnosticsLogger =

override ErrorCount: int

/// Represents a DiagnosticsLogger that captures all diagnostics, optionally formatting them
/// eagerly.
type ConcurrentCapturingDiagnosticsLogger =
inherit DiagnosticsLogger

new: nm: string * ?eagerFormat: (PhasedDiagnostic -> PhasedDiagnostic) -> ConcurrentCapturingDiagnosticsLogger

member CommitDelayedDiagnostics: diagnosticsLogger: DiagnosticsLogger -> unit

override DiagnosticSink: diagnostic: PhasedDiagnostic * severity: FSharpDiagnosticSeverity -> unit

member Diagnostics: (PhasedDiagnostic * FSharpDiagnosticSeverity) list

override ErrorCount: int

/// Thread statics for the installed diagnostic logger
[<Class>]
type DiagnosticsAsyncState =
Expand Down Expand Up @@ -318,7 +303,7 @@ val error: exn: exn -> 'T
/// Reports an informational diagnostic
val informationalWarning: exn: exn -> unit

val simulateError: diagnostic: PhasedDiagnostic -> 'T
val simulateError: diagnostic: PhasedDiagnostic -> 'Tt

val diagnosticSink: diagnostic: PhasedDiagnostic * severity: FSharpDiagnosticSeverity -> unit

Expand Down

0 comments on commit d862d45

Please sign in to comment.