Table of Contents

Class Diagnostic

Namespace
MuLang.Core.Diagnostics
Assembly
MuLang.Core.dll

Represents a diagnostic produced while compiling MuLang source code.

public sealed record Diagnostic : IEquatable<Diagnostic>
Inheritance
Diagnostic
Implements
Inherited Members

Constructors

Diagnostic(string, DiagnosticSeverity, DiagnosticCategory, TextSpan, string)

Initializes a new instance of the Diagnostic class.

public Diagnostic(string code, DiagnosticSeverity severity, DiagnosticCategory category, TextSpan span, string message)

Parameters

code string

The error or diagnostic code.

severity DiagnosticSeverity

The diagnostic severity.

category DiagnosticCategory

The diagnostic category.

span TextSpan

The source span.

message string

The error or diagnostic message.

Exceptions

ArgumentException

Thrown when code or message is null, empty, or whitespace.

Properties

Category

Gets the compiler phase that produced the diagnostic.

public DiagnosticCategory Category { get; }

Property Value

DiagnosticCategory

Code

Gets the diagnostic code.

public string Code { get; }

Property Value

string

Message

Gets the diagnostic message.

public string Message { get; }

Property Value

string

Severity

Gets the diagnostic severity.

public DiagnosticSeverity Severity { get; }

Property Value

DiagnosticSeverity

Span

Gets the source span associated with the diagnostic.

public TextSpan Span { get; }

Property Value

TextSpan

Methods

Equals(Diagnostic?)

public bool Equals(Diagnostic? other)

Parameters

other Diagnostic

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

ToString()

public override string ToString()

Returns

string

Operators

operator ==(Diagnostic?, Diagnostic?)

public static bool operator ==(Diagnostic? left, Diagnostic? right)

Parameters

left Diagnostic
right Diagnostic

Returns

bool

operator !=(Diagnostic?, Diagnostic?)

public static bool operator !=(Diagnostic? left, Diagnostic? right)

Parameters

left Diagnostic
right Diagnostic

Returns

bool