Skip to content

Catch Either<_, Never> from the collapsed read.full - #3

Merged
coenttb merged 1 commit into
mainfrom
fix/read-full-typed-throws-swift-6.4
Jul 28, 2026
Merged

Catch Either<_, Never> from the collapsed read.full#3
coenttb merged 1 commit into
mainfrom
fix/read-full-typed-throws-swift-6.4

Conversation

@coenttb

@coenttb coenttb commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Downstream update for swift-foundations/swift-file-system#9.

Why

File.Read.full shipped a pair of overloads differing only in the throwing-ness of the closure. A non-throwing closure was viable for both, so Swift 6.4 reported ambiguous use of 'full' at this call site:

Sources/Package Manager/Package.Manager+Resolution.swift:38:45: error: ambiguous use of 'full'

Constraining the thrown type at the do did not help — both overloads stayed viable — so this was not fixable from the call site.

swift-file-system collapsed the pair to a single typed-throws generic form, since throwing-ness is not an overload axis.

Change

This closure is non-throwing, so E infers as Never and the thrown type is Either<File.System.Read.Full.Error, Never>, whose closure arm is statically uninhabited. Only the do throws(...) annotation changes.

Both arms still funnel to .state, so failure behaviour is unchanged.

Verification

Swift 6.4 (swiftlang-6.4.0.27.1), arm64 macOS, resolved against swift-file-system e5dd084.

  • swift build — green
  • swift test — green, 19 tests across 6 suites, exit 0

`File.Read.full` shipped a pair of overloads differing only in the
throwing-ness of the closure. A non-throwing closure was viable for both,
so Swift 6.4 reported `ambiguous use of 'full'` here — and constraining
the thrown type at the `do` did not disambiguate, because both overloads
stayed viable.

swift-file-system collapsed the pair to a single typed-throws generic
form. This closure is non-throwing, so `E` infers as `Never` and the
thrown type is now `Either<File.System.Read.Full.Error, Never>` whose
closure arm is statically uninhabited.

Both arms still funnel to `.state`, so the failure behaviour is
unchanged.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@coenttb
coenttb merged commit 79ef057 into main Jul 28, 2026
4 checks passed
@coenttb
coenttb deleted the fix/read-full-typed-throws-swift-6.4 branch July 28, 2026 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant