Severity
TokenDiagnostic.swift:17enum Severity
enum Severity
import SwiftSyntax
A library for working with Swift code.
struct TokenDiagnostic
If the token has an error that’s inherent to the token itself and not its surrounding structure, this defines the type of the error. byteOffset
specifies at which offset the error occurred.
case warning
case error
init(_ kind: Kind, byteOffset: Int)
Construct a diagnostic of the given kind
that is anchored at byteOffset
, measured in UTF-8 bytes relative to the leading trivia start of the token this diagnostic will be attached to.
init(_ kind: Kind, byteOffset: UInt16)
Construct a diagnostic of the given kind
that is anchored at byteOffset
, measured in UTF-8 bytes relative to the leading trivia start of the token this diagnostic will be attached to.
init?(combining lhs: TokenDiagnostic?, _ rhs: TokenDiagnostic?)
Picks the more severe error of lhs
and rhs
, preferring lhs
if they have the same severity.
let byteOffset: UInt16
The offset at which the error is, in bytes relative to the token’s leading trivia start (i.e. relative to the token’s position
)
let kind: Kind
The unique kind of this diagnostic.
var severity: Severity { get }
The severity of the diagnostic, i.e. whether it’s a warning or error.
enum Kind
Each diagnostic kind is uniquely represented by a value in this enum.
protocol Comparable : Equatable
A type that can be compared using the relational operators <
, <=
, >=
, and >
.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable : Equatable
A type that can be hashed into a Hasher
to produce an integer hash value.
protocol Sendable
static func != (lhs: Self, rhs: Self) -> Bool
Returns a Boolean value indicating whether two values are not equal.
static func ... (minimum: Self) -> PartialRangeFrom<Self>
Returns a partial range extending upward from a lower bound.
static func ... (maximum: Self) -> PartialRangeThrough<Self>
Returns a partial range up to, and including, its upper bound.
static func ... (minimum: Self, maximum: Self) -> ClosedRange<Self>
Returns a closed range that contains both of its bounds.
static func ..< (maximum: Self) -> PartialRangeUpTo<Self>
Returns a partial range up to, but not including, its upper bound.
static func ..< (minimum: Self, maximum: Self) -> Range<Self>
Returns a half-open range that contains its lower bound but not its upper bound.
static func <= (lhs: Self, rhs: Self) -> Bool
Returns a Boolean value indicating whether the value of the first argument is less than or equal to that of the second argument.
static func > (lhs: Self, rhs: Self) -> Bool
Returns a Boolean value indicating whether the value of the first argument is greater than that of the second argument.
static func >= (lhs: Self, rhs: Self) -> Bool
Returns a Boolean value indicating whether the value of the first argument is greater than or equal to that of the second argument.