Skip to content

Commit 94a0095

Browse files
committed
Make swift-syntax build in Swift 6 language mode
1 parent 27e8f91 commit 94a0095

File tree

12 files changed

+16
-15
lines changed

12 files changed

+16
-15
lines changed

Package.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,8 @@ let package = Package(
294294
dependencies: ["_InstructionCounter", "_SwiftSyntaxTestSupport", "SwiftIDEUtils", "SwiftParser", "SwiftSyntax"],
295295
exclude: ["Inputs"]
296296
),
297-
]
297+
],
298+
swiftLanguageVersions: [.v5, .version("6")]
298299
)
299300

300301
// 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/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")

Tests/SwiftParserTest/ParserTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class ParserTests: ParserTestCase {
8585
}
8686
}
8787

88-
let packageDir = URL(fileURLWithPath: #file)
88+
let packageDir = URL(fileURLWithPath: #filePath)
8989
.deletingLastPathComponent()
9090
.deletingLastPathComponent()
9191
.deletingLastPathComponent()

Tests/SwiftParserTest/SequentialToConcurrentEditTranslationTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func verifySequentialToConcurrentTranslation(
3737
_ sequential: [IncrementalEdit],
3838
_ expectedConcurrent: [IncrementalEdit],
3939
testString: String = longString,
40-
file: StaticString = #file,
40+
file: StaticString = #filePath,
4141
line: UInt = #line
4242
) {
4343
let concurrent = ConcurrentEdits(fromSequential: sequential)

Tests/SwiftSyntaxMacroExpansionTest/LexicalContextTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,8 @@ struct AllLexicalContextsMacro: DeclarationMacro {
200200
}
201201
}
202202

203-
public struct LexicalContextDescriptionMacro: ExpressionMacro {
204-
public static func expansion(
203+
struct LexicalContextDescriptionMacro: ExpressionMacro {
204+
static func expansion(
205205
of node: some FreestandingMacroExpansionSyntax,
206206
in context: some MacroExpansionContext
207207
) throws -> ExprSyntax {

0 commit comments

Comments
 (0)