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
codestringThe error or diagnostic code.
severityDiagnosticSeverityThe diagnostic severity.
categoryDiagnosticCategoryThe diagnostic category.
spanTextSpanThe source span.
messagestringThe error or diagnostic message.
Exceptions
- ArgumentException
Thrown when
codeormessageis null, empty, or whitespace.
Properties
Category
Gets the compiler phase that produced the diagnostic.
public DiagnosticCategory Category { get; }
Property Value
Code
Gets the diagnostic code.
public string Code { get; }
Property Value
Message
Gets the diagnostic message.
public string Message { get; }
Property Value
Severity
Gets the diagnostic severity.
public DiagnosticSeverity Severity { get; }
Property Value
Span
Gets the source span associated with the diagnostic.
public TextSpan Span { get; }
Property Value
Methods
Equals(Diagnostic?)
public bool Equals(Diagnostic? other)
Parameters
otherDiagnostic
Returns
Equals(object?)
public override bool Equals(object? obj)
Parameters
objobject
Returns
GetHashCode()
public override int GetHashCode()
Returns
ToString()
public override string ToString()
Returns
Operators
operator ==(Diagnostic?, Diagnostic?)
public static bool operator ==(Diagnostic? left, Diagnostic? right)
Parameters
leftDiagnosticrightDiagnostic
Returns
operator !=(Diagnostic?, Diagnostic?)
public static bool operator !=(Diagnostic? left, Diagnostic? right)
Parameters
leftDiagnosticrightDiagnostic