Repository navigation
feat: CatchAsync takes a ValueTask, and TraverseAsync reaches Option and Patch - #94
Merged
Merged
Conversation
…and Patch Result.CatchAsync gains four ValueTask forms, valued and command, wide and narrowed, catching as the Task forms do. Each is [OverloadResolutionPriority(-1)], so an async lambda binds to the Task form as before; without it the repository's own CatchAsync calls are CS0121, the ambiguity decision 30 measured. Catch keeps refusing a ValueTask at run time. Option<T>.TraverseAsync and Patch<T>.TraverseAsync, with token forms, are the synchronous Traverse with the operation awaited: None, a clear and an absent field call nothing and check no token. Decision 110 records both. The completeness tests (null delegate, null task, asynchronous context, uninitialized result) cover the eight new members. Closes #88 Co-Authored-By: Claude Opus 5.5 <[email protected]>
This was referenced Oct 28, 2026
This was referenced Oct 28, 2026
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.
Closes #88
Problem
A call that returns a
ValueTask, such asstream.ReadAsync(buffer), reachedResult.CatchAsynconly through.AsTask()or anasynclambda. Decision 30 leftValueTaskoverloads out because they made everyasynclambda ambiguous.Option<T>andPatch<T>hadTraversebut noTraverseAsync, so an asynchronous check of an optional input or a patch field needed aMatchby hand.Change
CatchAsyncover aValueTask: four forms (valued and command, wide and narrowed), each[OverloadResolutionPriority(-1)]. They catch as theTaskforms do. Anasynclambda still binds to theTaskform.Catchstill refuses aValueTaskat run time, because a compile error there would break a build that works today.TraverseAsynconOption<T>andPatch<T>, with token forms: the synchronousTraversewith the operation awaited.None, a clear and an absent field call nothing and check no token.docs/result.md: the compiledTraverseAsyncsample has anOptionline and aPatchline, and the surface table has a row for each.Traversesentences, theCatchAsyncbullets, and "A task given to Catch".Tests
CatchAsyncValueTaskTests:await, a narrowed form letting others propagate, a cancellation and a wrapped cancellation passed through, a timeout as the error, a null value and a task of a task refused.asynclambda and everyTaskdelegate binds to theTaskform, and everyValueTaskdelegate or method group to the new form.OptionPatchTraverseAsyncTests: a value awaited intoSome,Valueor the error;None, a clear and an absence pass through without a call, even with a cancelled token; the token is handed on; a cancelled token starts nothing.CatchAsynccalls in the tests are CS0121.await: 2 tests fail.Nonechecking the token: 1.🤖 Generated with Claude Code