Skip to content

Commit af27677

Browse files
authored
Merge pull request #2106 from ahoppen/require-61
Require Swift 6.1 to build SourceKit-LSP
2 parents 79dde81 + 705ae0d commit af27677

File tree

6 files changed

+1
-59
lines changed

6 files changed

+1
-59
lines changed

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version: 6.0
1+
// swift-tools-version: 6.1
22

33
import Foundation
44
import PackageDescription

Sources/SKLogging/Logging.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,9 @@ package typealias LogLevel = os.OSLogType
1919
package typealias Logger = os.Logger
2020
package typealias Signposter = OSSignposter
2121

22-
#if compiler(<5.11)
23-
extension OSSignposter: @unchecked Sendable {}
24-
extension OSSignpostID: @unchecked Sendable {}
25-
extension OSSignpostIntervalState: @unchecked Sendable {}
26-
#else
2722
extension OSSignposter: @retroactive @unchecked Sendable {}
2823
extension OSSignpostID: @retroactive @unchecked Sendable {}
2924
extension OSSignpostIntervalState: @retroactive @unchecked Sendable {}
30-
#endif
3125

3226
extension os.Logger {
3327
package func makeSignposter() -> Signposter {

Sources/SKTestSupport/SkipUnless.swift

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -353,30 +353,6 @@ package actor SkipUnless {
353353
return .featureSupported
354354
}
355355
}
356-
357-
/// Checks that swift-format supports running as `swift-format format -` to indicate that the source file should be
358-
/// read from stdin, ie. that swift-format contains https://github.com/swiftlang/swift-format/pull/914.
359-
package static func swiftFormatSupportsDashToIndicateReadingFromStdin(
360-
file: StaticString = #filePath,
361-
line: UInt = #line
362-
) async throws {
363-
return try await shared.skipUnlessSupportedByToolchain(swiftVersion: SwiftVersion(6, 1), file: file, line: line) {
364-
guard let swiftFormatPath = await ToolchainRegistry.forTesting.default?.swiftFormat else {
365-
throw GenericError("Could not find swift-format")
366-
}
367-
let process = TSCBasic.Process(arguments: [try swiftFormatPath.filePath, "format", "-"])
368-
let writeStream = try process.launch()
369-
writeStream.send("let x = 1")
370-
try writeStream.close()
371-
let result = try await process.waitUntilExitStoppingProcessOnTaskCancellation()
372-
let output = try result.utf8Output()
373-
switch output {
374-
case "": return false
375-
case "let x = 1\n": return true
376-
default: throw GenericError("Received unexpected formatting output: '\(output)'")
377-
}
378-
}
379-
}
380356
}
381357

382358
// MARK: - Parsing Swift compiler version

Tests/SourceKitLSPTests/FormattingTests.swift

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ import class TSCBasic.Process
2222

2323
final class FormattingTests: XCTestCase {
2424
func testFormatting() async throws {
25-
try await SkipUnless.swiftFormatSupportsDashToIndicateReadingFromStdin()
26-
2725
let testClient = try await TestSourceKitLSPClient()
2826
let uri = DocumentURI(for: .swift)
2927

@@ -57,8 +55,6 @@ final class FormattingTests: XCTestCase {
5755
}
5856

5957
func testFormattingNoEdits() async throws {
60-
try await SkipUnless.swiftFormatSupportsDashToIndicateReadingFromStdin()
61-
6258
let testClient = try await TestSourceKitLSPClient()
6359
let uri = DocumentURI(for: .swift)
6460

@@ -84,8 +80,6 @@ final class FormattingTests: XCTestCase {
8480
}
8581

8682
func testConfigFileOnDisk() async throws {
87-
try await SkipUnless.swiftFormatSupportsDashToIndicateReadingFromStdin()
88-
8983
// We pick up an invalid swift-format configuration file and thus don't set the user-provided options.
9084
let project = try await MultiFileTestProject(files: [
9185
".swift-format": """
@@ -120,8 +114,6 @@ final class FormattingTests: XCTestCase {
120114
}
121115

122116
func testConfigFileInParentDirectory() async throws {
123-
try await SkipUnless.swiftFormatSupportsDashToIndicateReadingFromStdin()
124-
125117
// We pick up an invalid swift-format configuration file and thus don't set the user-provided options.
126118
let project = try await MultiFileTestProject(files: [
127119
".swift-format": """
@@ -156,8 +148,6 @@ final class FormattingTests: XCTestCase {
156148
}
157149

158150
func testConfigFileInNestedDirectory() async throws {
159-
try await SkipUnless.swiftFormatSupportsDashToIndicateReadingFromStdin()
160-
161151
// We pick up an invalid swift-format configuration file and thus don't set the user-provided options.
162152
let project = try await MultiFileTestProject(files: [
163153
".swift-format": """
@@ -200,8 +190,6 @@ final class FormattingTests: XCTestCase {
200190
}
201191

202192
func testInvalidConfigurationFile() async throws {
203-
try await SkipUnless.swiftFormatSupportsDashToIndicateReadingFromStdin()
204-
205193
// We pick up an invalid swift-format configuration file and thus don't set the user-provided options.
206194
// The swift-format default is 2 spaces.
207195
let project = try await MultiFileTestProject(files: [
@@ -226,8 +214,6 @@ final class FormattingTests: XCTestCase {
226214
}
227215

228216
func testInsertAndRemove() async throws {
229-
try await SkipUnless.swiftFormatSupportsDashToIndicateReadingFromStdin()
230-
231217
let testClient = try await TestSourceKitLSPClient()
232218
let uri = DocumentURI(for: .swift)
233219

@@ -259,8 +245,6 @@ final class FormattingTests: XCTestCase {
259245
}
260246

261247
func testMultiLineStringInsertion() async throws {
262-
try await SkipUnless.swiftFormatSupportsDashToIndicateReadingFromStdin()
263-
264248
let testClient = try await TestSourceKitLSPClient()
265249
let uri = DocumentURI(for: .swift)
266250

Tests/SourceKitLSPTests/OnTypeFormattingTests.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ import XCTest
1818

1919
final class OnTypeFormattingTests: XCTestCase {
2020
func testOnlyFormatsSpecifiedLine() async throws {
21-
try await SkipUnless.swiftFormatSupportsDashToIndicateReadingFromStdin()
22-
2321
let testClient = try await TestSourceKitLSPClient()
2422
let uri = DocumentURI(for: .swift)
2523

@@ -53,8 +51,6 @@ final class OnTypeFormattingTests: XCTestCase {
5351
}
5452

5553
func testFormatsFullLineAndDoesNotFormatNextLine() async throws {
56-
try await SkipUnless.swiftFormatSupportsDashToIndicateReadingFromStdin()
57-
5854
let testClient = try await TestSourceKitLSPClient()
5955
let uri = DocumentURI(for: .swift)
6056

@@ -92,8 +88,6 @@ final class OnTypeFormattingTests: XCTestCase {
9288
/// Otherwise could mess up writing code. You'd write {} and try to go into the braces to write more code,
9389
/// only for on-type formatting to immediately close the braces again.
9490
func testDoesNothingWhenInAnEmptyLine() async throws {
95-
try await SkipUnless.swiftFormatSupportsDashToIndicateReadingFromStdin()
96-
9791
let testClient = try await TestSourceKitLSPClient()
9892
let uri = DocumentURI(for: .swift)
9993

Tests/SourceKitLSPTests/RangeFormattingTests.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ import XCTest
1818

1919
final class RangeFormattingTests: XCTestCase {
2020
func testOnlyFormatsSpecifiedLines() async throws {
21-
try await SkipUnless.swiftFormatSupportsDashToIndicateReadingFromStdin()
22-
2321
let testClient = try await TestSourceKitLSPClient()
2422
let uri = DocumentURI(for: .swift)
2523

@@ -52,8 +50,6 @@ final class RangeFormattingTests: XCTestCase {
5250
}
5351

5452
func testOnlyFormatsSpecifiedColumns() async throws {
55-
try await SkipUnless.swiftFormatSupportsDashToIndicateReadingFromStdin()
56-
5753
let testClient = try await TestSourceKitLSPClient()
5854
let uri = DocumentURI(for: .swift)
5955

@@ -86,8 +82,6 @@ final class RangeFormattingTests: XCTestCase {
8682
}
8783

8884
func testFormatsMultipleLines() async throws {
89-
try await SkipUnless.swiftFormatSupportsDashToIndicateReadingFromStdin()
90-
9185
let testClient = try await TestSourceKitLSPClient()
9286
let uri = DocumentURI(for: .swift)
9387

0 commit comments

Comments
 (0)