Skip to content

feat: add MatchAsync, MapAsync and ThenAsync - #36

Merged
Frognar merged 1 commit into
mainfrom
feat/tp-10-async
Nov 14, 2026
Merged

Frognar merged 1 commit into
mainfrom
feat/tp-10-async

Conversation

@Frognar

@Frognar Frognar commented Nov 14, 2026

Copy link
Copy Markdown
Owner

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) and ThenAsync(next). The delegates return Task<…> and the methods return ValueTask<…>. 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; an OperationCanceledException for a requested token gives a canceled result; the passing-through case is already complete. A null from map, or an uninitialized validation from next, fails when awaited.

Tests: AsyncProperties (agree with Match/Map/Then for 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, and ConfigureAwait(false). A counting SynchronizationContext with 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

  • Tests cover the change (properties first, examples only where a property does not fit)
  • dotnet test --solution dotValid.slnx is green locally
  • Public API changes have XML docs

🤖 Generated with Claude Code

https://claude.ai/code/session_012weRUz3QcTAaQw32ZmQkoK

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);
}
@Frognar
Frognar merged commit 4395635 into main Nov 14, 2026
5 checks passed
@Frognar
Frognar deleted the feat/tp-10-async branch November 14, 2026 11:00
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.

feat: add MatchAsync, MapAsync and ThenAsync (TP-10)

2 participants