Skip to content

Make & take a void side as the unit factor pack<> - #441

Merged
Bronek merged 4 commits into
mainfrom
bronek/void_unit_factor
Sep 29, 2026
Merged

Bronek merged 4 commits into
mainfrom
bronek/void_unit_factor

Conversation

@Bronek

@Bronek Bronek commented Sep 28, 2026

Copy link
Copy Markdown
Member

Treat a void value as pack<> in conjunctions across carrier pairings. For example, expected<int, E> & just<void> yields expected<pack<int>, E>. Two void values still yield void.

Breaking: callers accessing .value() receive a pack; callbacks still receive its unpacked elements.

Build pack::append results directly to avoid extra moves inside noexcept calls. Brace aggregate layers so element conversions cannot initialize a whole layer. Document the void rules in TYPE_ALGEBRA.md.

Assisted-by: Claude:claude-opus-5-5
Assisted-by: Codex:gpt-6-astra

@Bronek
Bronek added this pull request to stack #445 September 28, 2026 20:14
@augmentcode

augmentcode Bot commented Sep 28, 2026

Copy link
Copy Markdown
🤖 Augment PR Summary

Summary: This PR redefines conjunction so a void value contributes the unit factor pack<>.



Changes:

  • Updates expected, just, and optional conjunction overloads for the new rule.
  • Preserves void only when both conjunction operands are void-valued.
  • Introduces shared factor helpers that map a carrier's void value type to pack<>.
  • Updates expected/choice distribution and uninhabited-value handling around the new factors.
  • Builds pack::append results directly, avoiding a relocation through a base subobject.
  • Adds braced aggregate construction to prevent element conversions from targeting an enclosing layer.
  • Expands conjunction and append tests, including type, value-category, noexcept, and conversion cases.
  • Updates the algebra guide, API reference, example, and changelog for the breaking result-type change.
Technical notes: Successful callbacks still receive unpacked pack elements, while direct .value() access now observes the added pack layer.

🤖 Was this summary useful? React with 👍 or 👎

@augmentcode augmentcode Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. No suggestions at this time.

Comment augment review to trigger a new review at any time.

@Bronek
Bronek force-pushed the bronek/void_unit_factor branch from e87b942 to f77f41a Compare September 28, 2026 20:38
@codecov

codecov Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@Bronek
Bronek force-pushed the bronek/void_unit_factor branch from f77f41a to 82e058b Compare September 28, 2026 21:18
@Bronek
Bronek removed this pull request from stack #445 September 29, 2026 21:20
@Bronek
Bronek added this pull request to stack #446 September 29, 2026 21:21
@Bronek
Bronek removed this pull request from stack #446 September 29, 2026 21:24
@Bronek
Bronek force-pushed the bronek/fix_void_transform_grading branch from c0abe37 to 1ffad00 Compare September 29, 2026 21:30
@Bronek
Bronek force-pushed the bronek/void_unit_factor branch from 0a301b4 to 850ac60 Compare September 29, 2026 21:30
@Bronek
Bronek changed the base branch from bronek/fix_void_transform_grading to main September 29, 2026 21:31
Treat a void value as pack<> in conjunctions across carrier pairings.
For example, expected<int, E> & just<void> now yields
expected<pack<int>, E>. Two void values still yield void.

Build pack::append results directly to avoid an extra relocation through
a base subobject. Brace each aggregate layer so an element conversion
cannot initialize the layer instead of the element.

Assisted-by: Claude:claude-opus-5-5
Assisted-by: Codex:gpt-6-astra
The test routed each result through a conditional operator and asserted
exact totals, so it also counted relocations the compiler may or may not
elide; MSVC's differed. Results now bind to a reference. Lvalue operands
keep the exact count (one copy, no move), which the `noexcept`
specification relies on; rvalue operands assert only that nothing is
copied.

Assisted-by: Claude:claude-opus-5-5
…ion reached

`optional & expected<T, copack<>>` with an engaged optional was checked by
`static_assert` alone, and `pack::append`'s throwing relocations had no
runtime test, so coverage saw neither. The runtime twins and a test that a
throwing copy propagates out of `append` close both.

Assisted-by: Claude:claude-opus-5-5
@Bronek
Bronek force-pushed the bronek/void_unit_factor branch from 850ac60 to 5299f38 Compare September 29, 2026 21:32
@Bronek
Bronek merged commit d4ced3a into main Sep 29, 2026
54 checks passed
@sonarqubecloud

Copy link
Copy Markdown

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.

1 participant