Repository navigation
t27b: an optional enum compared with a variant is equal only when it holds that tag, as in the reference (Closes #7811) - #7934
Merged
Merged
Conversation
…holds that tag, as in the reference (Closes #7811) t27c prints `?E == v` as written, and Zig compares an optional with a value of its payload type: equal only when the optional holds a value and that value is v, so null is `!=` every variant. t27b took that comparison only for a scalar payload and refused an enum payload as ExprBinary(?T), which blocked specs/port/trios/crates/trios-store/rings/ST-00/src/lib.t27 (`Adapter_parse("claude") == Adapter.Claude`). The decision is in specs/tri/t27b/optional_compare_plan.t27 (4 tests), generated with `t27c gen-rust` to gen/rust/tri/t27b/optional_compare_plan.rs and mounted in cli/t27b/src/lower.rs. A scalar payload compares by value as before; an enum payload compares by tag through enum_compare, so a variant of another enum is refused as `type mismatch`, as Zig refuses it; any other payload keeps ExprBinary(?T). The conformance spec is specs/tri/t27b/conformance/optional_enum_compare.t27: `t27c test-report` 6/6, 0 vacuous. Glue: lower.rs +6 -3, tests/tail.rs +15. Ledger: ST-00/src/lib.t27 now passes; the two new specs are new rows. Part of #6063. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lower.rs and tests/tail.rs merge cleanly. AGENTS.md takes master's and adds this branch's step: 15227 plus 1202 and 8164, on master 824c82d's 15224 plus 1202 and 8149. The ledger takes master's and re-applies this branch's rows: pass 931, not_pass 33. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gHashTag
enabled auto-merge (squash)
October 8, 2026 20:58
This was referenced Oct 8, 2026
Merged
Contributor
This was referenced Oct 8, 2026
gHashTag
pushed a commit
that referenced
this pull request
Oct 8, 2026
From master's side (#7934's optional enum compare; lower.rs conflicted only on the doc comment of opt_compare, kept as master wrote it, with this branch's ptr_compare and ptr_word above it; master's optional_enum_compare.t27, const_optional.t27, postfix_optional.t27 and optional_compare_plan.t27 pass with this merge's t27b under --check). docs/reports/t27b_expectations.json: master's ledger plus this branch's three rows, recomposed as before (gen_hazard_pointers.t27 -> pass, two new pass rows): pass 931 -> 934, max_not_pass 33 -> 32. AGENTS.md: master's remainder plus this branch's clause, re-measured with `wc -l` over master 408d740: src/*.rs 15227 -> 15266, src/*/*.rs unchanged, tests/*.rs 8164 -> 8172. Merged-tree checks on the t27c lab: cargo test --release -p t27b 130 passed, 0 failed; under `t27b test --check` gen_hazard_pointers.t27 (4/4), pointer_equality.t27, ptr_eq_plan.t27 and opaque_pointer.t27 pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gHashTag
pushed a commit
that referenced
this pull request
Oct 9, 2026
…27b-const-div (Closes #7812) lower.rs and tests/tail.rs keep both sides. AGENTS.md takes master's and adds this branch's step: 15235 plus 1233 and 8200, on master 4270760's 15232 plus 1233 and 8183. The ledger takes master's (no stored counts since #7862) and re-applies this branch's rows; max_not_pass 31 -> 30. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.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.
Closes #7811. Part of #6063 (t27b coverage), which is item C10 of #6488.
What the reference does
specs/port/trios/crates/trios-store/rings/ST-00/src/lib.t27passes the reference 6/6. t27b refused it at lines 126-129 withExprBinary(?T)('==' on ?Adapter):assert(Adapter_parse("claude") == Adapter.Claude), whereAdapter_parsereturns?Adapter. t27b compared an optional with a value of its payload only when the payload was a scalar.t27c prints the comparison as written. Zig compares an optional with a value of its payload type. Measured on the t27c lab (
t27c test-report, zig 0.16.0, x86_64 Debug):?E == vwith the optional holding v / another variant / null?E != v, the same threev == ?E, the optional on the right?Elocal against anElocalenum(u16)with tags 1 and 300?K == L.A, a variant of another enum!(?E == v)written inline in anassert!before the comparison (Zig: "expected type 'bool', found '?spec.OeKind'"), so the conformance spec binds such a result to a local firstDecision, with the evidence
The decision is a t27 plan,
specs/tri/t27b/optional_compare_plan.t27, with 4 tests.t27c gen-rustturns it intogen/rust/tri/t27b/optional_compare_plan.rs, andlower.rsmounts that file with#[path]. The glue inopt_comparereads the payload's kind and askspayload:enum_compareas two values of one enum. So a variant of another enum is refused astype mismatch, as Zig refuses it.ExprBinary(?T). Pointers are t27b: == and != between pointers and optional pointers compare addresses #7742's.opt_compare's other questions are unchanged and asked first: two optionals, an ordering operator, and an operand with effects.Conformance spec first
specs/tri/t27b/conformance/optional_enum_compare.t27has 6 tests:Adapter_parseshape: a fn returning a variant or null, with its calls counted;enum(u16)with a wide tag.t27c test-reportseal --save, then--verify: all hashes MATCH)ExprBinary(?T)t27b test --check)t27c test-report4/4, 0 vacuous; sealed. All 5 plan mutants are caught by its tests.tail.rs. A null result fails the test, and?K == L.Ais refused astype mismatchat its line.Corpus
t27b corpus specs --blockers, master against this branch, on the t27c lab:ST-00/src/lib.t27and the conformance spec.trios-ternary/rings/TR-00/src/lib.t27andtri/utils/logging.t27loseExprBinary(?T)but keep other blockers. Neither is in the ledger, because the reference does not pass them.Lines (
git diff --numstat --no-renames origin/master...HEAD)cli/t27b/src/lower.rscli/t27b/tests/tail.rsgen/rust/tri/t27b/optional_compare_plan.rst27c gen-rust, not hand-editedspecs/tri/t27b/optional_compare_plan.t27specs/tri/t27b/conformance/optional_enum_compare.t27.trinity/seals/*.json(2)t27c seal --savedocs/reports/t27b_expectations.jsonAGENTS.mdHand-written foreign code: 21 added lines, 3 deleted (6 and 3 in
lower.rs, 15 intests/tail.rs). That is under the #7371 cap of 40 per file and 80 per PR. Both files are on master'stools/policy/foreign-exceptions.txt. This PR does not change that file and needs no label.AGENTS.md, re-measured with
wc -l:cli/t27b/src/*.rsgoes from 15224 to 15227, plus 1202 insrc/*/*.rs, andcli/t27b/tests/*.rsfrom 8149 to 8164, on master 824c82d.Ledger:
ST-00/src/lib.t27: blocked -> pass.Gates
Both gates ran on the t27c lab, using master 824c82d's
gen/c/policy/own_language.candlefthook.yml's one-line C main.check_budget()overgit diff --numstat --no-renames origin/master...HEAD: exit 0.check_all()withorigin/master:tools/policy/foreign-exceptions.txt,--andgit diff --name-status origin/master...HEAD: exit 0.cargo test --release -p t27bon the t27c lab (x86_64, interpreter only), on master 824c82d plus this branch: 129 passed, 0 failed. That includes the newan_optional_enum_compares_by_tag. The two seals verify (all hashes MATCH).t27b lab: signed receipts (#7686)
Head bd0f84c against its parent, master 7c88448. Head bd0f84c is this branch's first commit, on master 7c88448. Both are signed runs of the deployed t27b lab: the base is the lab's own master run, and the head was requested with a fresh 32-byte challenge.
/work/t27c-master corpus-receipt compare BASE HEAD --challenge-head <mine>, run on the t27b lab from/work/t27:Exit 3, IMPROVED_ONLY. (The
input,verdictandoutputlines name the same three files and are left out here.)cargo test --release -p t27b(aarch64, qemu)ST-00/src/lib.t27passes with 19 runtime asserts, the conformance spec with 20 and the plan with 11.The final head is bd0f84c merged with master 824c82d. That brings in #7744, #7863, #7870 and #7853. The merge resolved only the
AGENTS.mdline and the ledger counts;lower.rsandtests/tail.rsmerged cleanly. Its tree was checked on the t27c lab with the results under Gates.gen-rust gaps
None. The plan is decisions over
u8.🤖 Generated with Claude Code