Skip to content

Commit ef753da

Browse files
committed
Sendable autoconformance
1 parent 8e38bf1 commit ef753da

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
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:5.0
1+
// swift-tools-version:6.0
22
// The swift-tools-version declares the minimum version of Swift required to build this package.
33

44
import PackageDescription

Sources/Either/Either.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,10 @@ public enum Either<Left, Right> {
1414
case left(Left)
1515
case right(Right)
1616
}
17+
18+
19+
20+
// MARK: - Sendable
21+
// (this would be in `Either + autoconformance.swift`, but the compiler prefers it in the same file as the original declaration
22+
23+
extension Either: Sendable where Left: Sendable, Right: Sendable {}

Tests/EitherTests/Either + autoconformance Tests.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,3 +371,14 @@ final class Either___autoconformance_Tests: XCTestCase {
371371
}
372372
}
373373
}
374+
375+
376+
377+
// MARK: - Either + Sendable
378+
379+
// Just test whether it compiles
380+
381+
private struct SendableConformanceTestContainer: Sendable {
382+
var eitherA: Either<Int, String> = .left(7)
383+
var eitherB: Either<Int, String> = .right("seven")
384+
}

0 commit comments

Comments
 (0)