Skip to content

Commit a70189b

Browse files
committed
Make swift-syntax build in Swift 6 language mode
1 parent 1099b16 commit a70189b

File tree

13 files changed

+24
-17
lines changed

13 files changed

+24
-17
lines changed

Package.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,8 @@ let package = Package(
297297
dependencies: ["_InstructionCounter", "_SwiftSyntaxTestSupport", "SwiftIDEUtils", "SwiftParser", "SwiftSyntax"],
298298
exclude: ["Inputs"]
299299
),
300-
]
300+
],
301+
swiftLanguageVersions: [.v5, .version("6")]
301302
)
302303

303304
// This is a fake target that depends on all targets in the package.

Sources/SwiftParser/ExpressionInterpretedAsVersionTuple.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13+
#if swift(>=6)
14+
@_spi(RawSyntax) public import SwiftSyntax
15+
#else
1316
@_spi(RawSyntax) import SwiftSyntax
17+
#endif
1418

1519
extension ExprSyntax {
1620
/// Parse the source code of this node as a `VersionTupleSyntax`.

Sources/SwiftParser/TokenSpec.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ struct PrepareForKeywordMatch {
4949
/// matching against and is thus able to rule out one of the branches in
5050
/// `matches(rawTokenKind:text:)` based on the matched kind.
5151
@_spi(AlternateTokenIntrospection)
52-
public struct TokenSpec {
52+
public struct TokenSpec: Sendable {
5353
/// The kind we expect the token that we want to consume to have.
5454
/// This can be a keyword, in which case the ``TokenSpec`` will also match an
5555
/// identifier with the same text as the keyword and remap it to that keyword

Sources/SwiftParser/TokenSpecSet.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,7 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
#if swift(>=6)
14-
@_spi(RawSyntax) @_spi(ExperimentalLanguageFeatures) public import SwiftSyntax
15-
#else
1613
@_spi(RawSyntax) @_spi(ExperimentalLanguageFeatures) import SwiftSyntax
17-
#endif
1814

1915
/// A set of `TokenSpecs`. We expect to consume one of the sets specs in the
2016
/// parser.

Sources/SwiftSyntaxMacrosTestSupport/Assertions.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public struct NoteSpec {
6363
message: String,
6464
line: Int,
6565
column: Int,
66-
originatorFile: StaticString = #file,
66+
originatorFile: StaticString = #filePath,
6767
originatorLine: UInt = #line
6868
) {
6969
self.message = message

SwiftSyntaxDevUtils/Sources/swift-syntax-dev-utils/common/Paths.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import Foundation
1414

1515
enum Paths {
1616
static var packageDir: URL {
17-
URL(fileURLWithPath: #file)
17+
URL(fileURLWithPath: #filePath)
1818
.deletingLastPathComponent()
1919
.deletingLastPathComponent()
2020
.deletingLastPathComponent()

Tests/PerformanceTest/InstructionsCountAssertion.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ fileprivate var baselineURL: URL {
1717
if let baselineFile = ProcessInfo.processInfo.environment["BASELINE_FILE"] {
1818
return URL(fileURLWithPath: baselineFile)
1919
} else {
20-
return URL(fileURLWithPath: #file)
20+
return URL(fileURLWithPath: #filePath)
2121
.deletingLastPathComponent()
2222
.appendingPathComponent("baselines.json")
2323
}

Tests/PerformanceTest/ParsingPerformanceTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import _SwiftSyntaxTestSupport
1818
class ParsingPerformanceTests: XCTestCase {
1919

2020
var inputFile: URL {
21-
return URL(fileURLWithPath: #file)
21+
return URL(fileURLWithPath: #filePath)
2222
.deletingLastPathComponent()
2323
.appendingPathComponent("Inputs")
2424
.appendingPathComponent("MinimalCollections.swift.input")

Tests/PerformanceTest/SyntaxClassifierPerformanceTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import _SwiftSyntaxTestSupport
1919
class SyntaxClassifierPerformanceTests: XCTestCase {
2020

2121
var inputFile: URL {
22-
return URL(fileURLWithPath: #file)
22+
return URL(fileURLWithPath: #filePath)
2323
.deletingLastPathComponent()
2424
.appendingPathComponent("Inputs")
2525
.appendingPathComponent("MinimalCollections.swift.input")

Tests/PerformanceTest/VisitorPerformanceTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import _SwiftSyntaxTestSupport
1818
class VisitorPerformanceTests: XCTestCase {
1919

2020
var inputFile: URL {
21-
return URL(fileURLWithPath: #file)
21+
return URL(fileURLWithPath: #filePath)
2222
.deletingLastPathComponent()
2323
.appendingPathComponent("Inputs")
2424
.appendingPathComponent("MinimalCollections.swift.input")

0 commit comments

Comments
 (0)