Catch Either<_, Never> from the collapsed read.full - #3
Merged
Conversation
`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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Downstream update for swift-foundations/swift-file-system#9.
Why
File.Read.fullshipped 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 reportedambiguous use of 'full'at this call site:Constraining the thrown type at the
dodid 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
Einfers asNeverand the thrown type isEither<File.System.Read.Full.Error, Never>, whose closure arm is statically uninhabited. Only thedo 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-systeme5dd084.swift build— greenswift test— green, 19 tests across 6 suites, exit 0