Fix merger rules of policies group issue#12
Merged
FrozenLemonTee merged 28 commits intomainfrom Mar 22, 2026
Merged
Conversation
…g type strategies for the rules of underlying negotiation in double primitive types
…tions of primitive
…f the binary version
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the primitives framework’s policy resolution/negotiation rules and expands the operations surface to support mixed primitive/underlying operands, adding ThreeWayCompare and compound-assignment support alongside additional compile-time consistency checks.
Changes:
- Enforce “policy group” consistency after default completion (value/type/error/concurrency) and tighten type negotiation rules (non-void
common_rep, compatible requires same underlying category). - Add mixed operand overloads for operations (
primitive↔ underlying), addThreeWayCompare, and implement compound assignment operators via dispatcher-basedapply_assign. - Add cross-underlying constructors/assignments/store/CAS for
primitive, and refactor exported trait APIs (traits→meta,primitive_traits→meta::traits).
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/basic/test_templates.cpp | Adds custom underlying/common-rep test cases, including a void common-rep scenario. |
| tests/basic/test_operations.cpp | Adds tests for cross-underlying construction/store/CAS, mixed operand operations, three-way compare, and compound assignment. |
| src/primitive/traits.cppm | Refactors exported primitive traits into mcpplibs::primitives::meta. |
| src/primitive/impl.cppm | Implements cross-underlying primitive constructors/assignments/store/CAS and adds an explicit disabled underlying::traits specialization for primitive. |
| src/policy/utility.cppm | Centralizes resolve_policy_t with “at most one policy per category” enforcement. |
| src/policy/impl.cppm | Tightens type-policy checks (same category for compatible, non-void common rep) and adds integral narrowing helper. |
| src/operations/operators.cppm | Adds mixed operand overloads, three-way compare API, and compound-assignment implementation. |
| src/operations/invoker.cppm | Implements three-way compare evaluation and binds it for all value policies. |
| src/operations/impl.cppm | Introduces the ThreeWayCompare operation tag and traits. |
| src/operations/dispatcher.cppm | Switches to meta::traits, enforces policy-group consistency, and asserts non-void common rep when allowed. |
| .github/prompts/plan-policyBehaviorProtocol.prompt.md | Updates the design/plan document to match the new constraints and overload goals. |
| .github/copilot-instructions.md | Minor documentation update referencing the prompts directory. |
…nversions Signed-off-by: FrozenlemonTee <1115306170@qq.com>
…fety Signed-off-by: FrozenlemonTee <1115306170@qq.com>
Signed-off-by: FrozenlemonTee <1115306170@qq.com>
…imitive types Signed-off-by: FrozenlemonTee <1115306170@qq.com>
… and ensure legacy aliases remain available Signed-off-by: FrozenlemonTee <1115306170@qq.com>
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.
PR changes: