Skip to content

Derive adaptor completion attributes from their sources - #359

Draft
Cra3z wants to merge 1 commit into
bemanproject:mainfrom
Cra3z:fix-sender-attrs
Draft

Cra3z wants to merge 1 commit into
bemanproject:mainfrom
Cra3z:fix-sender-attrs

Conversation

@Cra3z

@Cra3z Cra3z commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

In the current implementation, the following program cannot be compiled:

ex::run_loop loop;
ex::prop env{
  ex::get_start_scheduler,
  loop.get_scheduler()
};

auto sndr1 = ex::just_stopped() | ex::stopped_as_error(-1);
auto sch1 = ex::get_completion_scheduler<ex::set_error_t>(ex::get_env(sndr1), env);
assert(sch1 == loop.get_scheduler());

auto sndr2 = ex::just_error(-1) | ex::upon_error([](int i) noexcept { return i; });
auto sch2 = ex::get_completion_scheduler<ex::set_value_t>(ex::get_env(sndr2), env);
assert(sch2 == loop.get_scheduler());

Adaptors that change which channel a completion arrives on forwarded the child's completion scheduler and domain unchanged, so e.g. upon_error reported the child's value scheduler for a value completion that actually comes from the child's error completion.

Add remap_attrs, which answers get_completion_scheduler<Tag> and get_completion_domain<Tag> from the child completions that can produce Tag:

  • the domain is the common domain of all sources;
  • the scheduler is reported only if all sources share one origin;
  • a tag without sources has no domain.

Use it for then/upon_error/upon_stopped, bulk*, into_variant, stopped_as_optional, stopped_as_error and the parallel scheduler's bulk sender.

Also fix common_type of indeterminate_domain<> with a bare domain to yield that domain, per [exec.domain.indeterminate]/4.

This PR was developed with the assistance of Claude Opus 5.5. All code has been reviewed by me.

@Cra3z
Cra3z marked this pull request as draft November 27, 2026 09:49
Adaptors that change which channel a completion arrives on forwarded
the child's completion scheduler and domain unchanged, so e.g.
`upon_error` reported the child's value scheduler for a value
completion that actually comes from the child's error completion.

Add `remap_attrs`, which answers `get_completion_scheduler<Tag>` and
`get_completion_domain<Tag>` from the child completions that can
produce `Tag`:
- the domain is the common domain of all sources;
- the scheduler is reported only if all sources share one origin;
- a tag without sources has no domain.

Use it for `then`/`upon_error`/`upon_stopped`, `bulk*`,
`into_variant`, `stopped_as_optional`, `stopped_as_error`,
`stop_when` and the parallel scheduler's bulk sender.

Also fix `common_type` of `indeterminate_domain<>` with a bare domain
to yield that domain, per [exec.domain.indeterminate]/4.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 92.336% (-0.7%) from 93.084% — Cra3z:fix-sender-attrs into bemanproject:main

@Cra3z
Cra3z marked this pull request as ready for review November 27, 2026 12:14
@Cra3z
Cra3z marked this pull request as draft November 27, 2026 15:32

This branch has not been deployed

No deployments
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.

2 participants