Skip to content

Commit 9fcd8f3

Browse files
committed
Add Sendable annotations to all other modules in swift-syntax
1 parent 43ba656 commit 9fcd8f3

File tree

20 files changed

+31
-31
lines changed

20 files changed

+31
-31
lines changed

CodeGeneration/Sources/generate-swift-syntax/templates/swiftparser/ExperimentalFeaturesFile.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ let experimentalFeaturesFile = SourceFileSyntax(leadingTrivia: copyrightHeader)
2020
"""
2121
extension Parser {
2222
@_spi(ExperimentalLanguageFeatures)
23-
public struct ExperimentalFeatures: OptionSet {
23+
public struct ExperimentalFeatures: OptionSet, Sendable {
2424
public let rawValue: UInt
2525
public init(rawValue: UInt) {
2626
self.rawValue = rawValue

Sources/SwiftDiagnostics/Diagnostic.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
import SwiftSyntax
1414

15-
public struct Diagnostic: CustomDebugStringConvertible {
15+
public struct Diagnostic: CustomDebugStringConvertible, Sendable {
1616
/// The message that should be displayed to the user
1717
public let diagMessage: DiagnosticMessage
1818

@@ -74,7 +74,7 @@ public struct Diagnostic: CustomDebugStringConvertible {
7474
}
7575
}
7676

77-
public struct DiagnosticsError: Error {
77+
public struct DiagnosticsError: Error, Sendable {
7878
public var diagnostics: [Diagnostic]
7979

8080
/// The diagnostics must contain at least one with severity == `.error`.

Sources/SwiftDiagnostics/FixIt.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import SwiftSyntax
1515
/// Types conforming to this protocol represent Fix-It messages that can be
1616
/// shown to the client.
1717
/// The messages should describe the change that the Fix-It will perform
18-
public protocol FixItMessage {
18+
public protocol FixItMessage: Sendable {
1919
/// The Fix-It message that should be displayed in the client.
2020
var message: String { get }
2121

@@ -24,8 +24,8 @@ public protocol FixItMessage {
2424
}
2525

2626
/// A Fix-It that can be applied to resolve a diagnostic.
27-
public struct FixIt {
28-
public enum Change {
27+
public struct FixIt: Sendable {
28+
public enum Change: Sendable {
2929
/// Replace `oldNode` by `newNode`.
3030
case replace(oldNode: Syntax, newNode: Syntax)
3131
/// Replace the leading trivia on the given token

Sources/SwiftDiagnostics/Message.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public enum DiagnosticSeverity: Sendable {
3535

3636
/// Types conforming to this protocol represent diagnostic messages that can be
3737
/// shown to the client.
38-
public protocol DiagnosticMessage {
38+
public protocol DiagnosticMessage: Sendable {
3939
/// The diagnostic message that should be displayed in the client.
4040
var message: String { get }
4141

Sources/SwiftDiagnostics/Note.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import SwiftSyntax
1515
/// Types conforming to this protocol represent note messages that can be
1616
/// shown to the client.
1717
/// The messages should describe what the note is pointing at.
18-
public protocol NoteMessage {
18+
public protocol NoteMessage: Sendable {
1919
/// The message that should be displayed in the client.
2020
var message: String { get }
2121

@@ -31,7 +31,7 @@ extension NoteMessage {
3131
}
3232

3333
/// A note that points to another node that's relevant for a Diagnostic.
34-
public struct Note: CustomDebugStringConvertible {
34+
public struct Note: CustomDebugStringConvertible, Sendable {
3535
/// The node whose location the node is pointing.
3636
public let node: Syntax
3737

Sources/SwiftIDEUtils/SyntaxClassification.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
@_spi(RawSyntax) import SwiftSyntax
1414

15-
public enum SyntaxClassification {
15+
public enum SyntaxClassification: Sendable {
1616
/// An attribute starting with an `@`.
1717
case attribute
1818
/// A block comment starting with `/**` and ending with `*/.

Sources/SwiftIDEUtils/SyntaxClassifier.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ fileprivate struct TokenKindAndText {
8585
}
8686

8787
/// Represents a source range that is associated with a syntax classification.
88-
public struct SyntaxClassifiedRange: Equatable {
88+
public struct SyntaxClassifiedRange: Equatable, Sendable {
8989
public var kind: SyntaxClassification
9090
public var range: ByteSourceRange
9191

@@ -264,7 +264,7 @@ private struct ClassificationVisitor {
264264
}
265265

266266
/// Provides a sequence of ``SyntaxClassifiedRange``s for a syntax node.
267-
public struct SyntaxClassifications: Sequence {
267+
public struct SyntaxClassifications: Sequence, Sendable {
268268
public typealias Iterator = Array<SyntaxClassifiedRange>.Iterator
269269

270270
var classifications: [SyntaxClassifiedRange]

Sources/SwiftOperators/Operator.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import SwiftSyntax
1919
public typealias OperatorName = String
2020

2121
/// Describes the kind of an operator.
22-
public enum OperatorKind: String {
22+
public enum OperatorKind: String, Sendable {
2323
/// Infix operator such as the + in a + b.
2424
case infix
2525

@@ -31,7 +31,7 @@ public enum OperatorKind: String {
3131
}
3232

3333
/// Describes an operator.
34-
public struct Operator {
34+
public struct Operator: Sendable {
3535
public let kind: OperatorKind
3636
public let name: OperatorName
3737
public let precedenceGroup: PrecedenceGroupName?

Sources/SwiftOperators/OperatorError.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import SwiftSyntax
1313

1414
/// Describes errors that can occur when working with user-defined operators.
15-
public enum OperatorError: Error {
15+
public enum OperatorError: Error, Sendable {
1616
/// Error produced when a given precedence group already exists in the
1717
/// precedence graph.
1818
case groupAlreadyExists(existing: PrecedenceGroup, new: PrecedenceGroup)

Sources/SwiftOperators/OperatorTable.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import SwiftSyntax
1919
/// semantic representation, validating the correctness of those declarations,
2020
/// and "folding" sequence expression syntax into a structured expression
2121
/// syntax tree.
22-
public struct OperatorTable {
22+
public struct OperatorTable: Sendable {
2323
var precedenceGraph: PrecedenceGraph = .init()
2424
var infixOperators: [OperatorName: Operator] = [:]
2525
var prefixOperators: [OperatorName: Operator] = [:]

0 commit comments

Comments
 (0)