Repository navigation
feat: add MatchAsync, MapAsync and ThenAsync - #36
Merged
Merged
Conversation
Minimal async (V10) with dotResult's R8 semantics: Task delegates, ValueTask results, immediate argument checks, delegate exceptions through the ValueTask, cancellation for a requested token, and the passing-through case already complete. The library never resumes on the caller's context. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012weRUz3QcTAaQw32ZmQkoK
Comment on lines
+133
to
+136
| catch (Exception exception) | ||
| { | ||
| return ValueTask.FromException<TResult>(exception); | ||
| } |
Comment on lines
+149
to
+152
| catch (Exception exception) | ||
| { | ||
| return ValueTask.FromException<TResult>(exception); | ||
| } |
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.
What
TP-10, card 6.1 of milestone M6 (1.0.0-beta.1): minimal async (V10).
MatchAsync(valid, invalid)with an async or a synchronous invalid branch,MapAsync(map)andThenAsync(next). The delegates returnTask<…>and the methods returnValueTask<…>. Semantics as R8 in dotResult: arguments and the uninitialized default are checked immediately; whatever a delegate does, including a synchronous throw, comes out when awaited; anOperationCanceledExceptionfor a requested token gives a canceled result; the passing-through case is already complete. A null frommap, or an uninitialized validation fromnext, fails when awaited.Tests:
AsyncProperties(agree withMatch/Map/Thenfor completed and yielding tasks; exactly one branch; pass-through completes at once and runs nothing; throws only when awaited, including from the synchronous invalid branch; cancellation; missing delegates). Also uninitialized lines and allocation lines with completed tasks (0 B). Stryker found two gaps that are now covered: a throwing synchronous invalid branch, andConfigureAwait(false). A countingSynchronizationContextwith a task that really waits checks that the library never resumes on the caller's context. Stryker locally: 100 %. README "Async"; the AOT smoke test covers all three members.Closes #15
Checklist
dotnet test --solution dotValid.slnxis green locally🤖 Generated with Claude Code
https://claude.ai/code/session_012weRUz3QcTAaQw32ZmQkoK