Skip to content

Commit ff577da

Browse files
authored
Merge pull request #5 from RougeWare/feature/Sendable
Sendable autoconformance
2 parents 8e38bf1 + 269e783 commit ff577da

File tree

4 files changed

+38
-5
lines changed

4 files changed

+38
-5
lines changed

.github/workflows/swift.yml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,30 @@
1-
name: Tests
1+
# This workflow will build a Swift project
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift
23

3-
on: [push, pull_request]
4+
name: Swift
5+
6+
on:
7+
push:
8+
branches: [ "production" ]
9+
pull_request:
10+
branches: [ "production" ]
411

512
jobs:
613
build:
714

8-
runs-on: macOS-latest
15+
runs-on: macos-latest
916

1017
steps:
11-
- uses: actions/checkout@v1
18+
- uses: actions/checkout@v4
19+
- uses: k-arindam/setup-swift@v6.0.0
20+
with:
21+
swift-version: "6.0.0"
22+
23+
- name: Get swift version
24+
run: swift --version
25+
1226
- name: Build
1327
run: swift build -v
28+
1429
- name: Run tests
1530
run: swift test -v

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)