Skip to content

Commit 125e5d2

Browse files
authored
Merge pull request #971 from ahoppen/ahoppen/retroactive-conformances
Add `@retroactive` annotations
2 parents 911b973 + d2e79c8 commit 125e5d2

File tree

4 files changed

+39
-5
lines changed

4 files changed

+39
-5
lines changed

Sources/LSPTestSupport/TestJSONRPCConnection.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,11 @@ private let testMessageRegistry = MessageRegistry(
176176
notifications: [EchoNotification.self]
177177
)
178178

179+
#if swift(<5.10)
179180
extension String: ResponseType {}
181+
#else
182+
extension String: @retroactive ResponseType {}
183+
#endif
180184

181185
public struct EchoRequest: RequestType {
182186
public static var method: String = "test_server/echo"

Sources/SKSupport/LoggableMessageTypes.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,16 @@ fileprivate extension Encodable {
3333

3434
// MARK: - DocumentURI
3535

36-
extension DocumentURI: CustomLogStringConvertible {
36+
extension DocumentURI {
3737
public var redactedDescription: String {
3838
return "<DocumentURI length=\(description.count) hash=\(description.hashForLogging)>"
3939
}
4040
}
41+
#if swift(<5.10)
42+
extension DocumentURI: CustomLogStringConvertible {}
43+
#else
44+
extension DocumentURI: @retroactive CustomLogStringConvertible {}
45+
#endif
4146

4247
// MARK: - RequestType
4348

Sources/SourceKitLSP/IndexStoreDB+MainFilesProvider.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import LSPLogging
1515
import LanguageServerProtocol
1616
import SKCore
1717

18-
extension IndexStoreDB: MainFilesProvider {
18+
extension IndexStoreDB {
1919
public func mainFilesContainingFile(_ uri: DocumentURI) -> Set<DocumentURI> {
2020
let mainFiles: Set<DocumentURI>
2121
if let url = uri.fileURL {
@@ -30,3 +30,9 @@ extension IndexStoreDB: MainFilesProvider {
3030
return mainFiles
3131
}
3232
}
33+
34+
#if swift(<5.10)
35+
extension IndexStoreDB: MainFilesProvider {}
36+
#else
37+
extension IndexStoreDB: @retroactive MainFilesProvider {}
38+
#endif

Sources/sourcekit-lsp/SourceKitLSP.swift

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import struct TSCBasic.AbsolutePath
2525
import struct TSCBasic.RelativePath
2626
import var TSCBasic.localFileSystem
2727

28-
extension AbsolutePath: ExpressibleByArgument {
28+
extension AbsolutePath {
2929
public init?(argument: String) {
3030
let path: AbsolutePath?
3131

@@ -48,8 +48,13 @@ extension AbsolutePath: ExpressibleByArgument {
4848
.directory
4949
}
5050
}
51+
#if swift(<5.10)
52+
extension AbsolutePath: ExpressibleByArgument {}
53+
#else
54+
extension AbsolutePath: @retroactive ExpressibleByArgument {}
55+
#endif
5156

52-
extension RelativePath: ExpressibleByArgument {
57+
extension RelativePath {
5358
public init?(argument: String) {
5459
let path = try? RelativePath(validating: argument)
5560

@@ -60,8 +65,13 @@ extension RelativePath: ExpressibleByArgument {
6065
self = path
6166
}
6267
}
68+
#if swift(<5.10)
69+
extension RelativePath: ExpressibleByArgument {}
70+
#else
71+
extension RelativePath: @retroactive ExpressibleByArgument {}
72+
#endif
6373

64-
extension PathPrefixMapping: ExpressibleByArgument {
74+
extension PathPrefixMapping {
6575
public init?(argument: String) {
6676
guard let eqIndex = argument.firstIndex(of: "=") else { return nil }
6777
self.init(
@@ -70,8 +80,17 @@ extension PathPrefixMapping: ExpressibleByArgument {
7080
)
7181
}
7282
}
83+
#if swift(<5.10)
84+
extension PathPrefixMapping: ExpressibleByArgument {}
85+
#else
86+
extension PathPrefixMapping: @retroactive ExpressibleByArgument {}
87+
#endif
7388

89+
#if swift(<5.10)
7490
extension BuildConfiguration: ExpressibleByArgument {}
91+
#else
92+
extension BuildConfiguration: @retroactive ExpressibleByArgument {}
93+
#endif
7594

7695
@main
7796
struct SourceKitLSP: ParsableCommand {

0 commit comments

Comments
 (0)