fix: compare optional payloads structurally, and finish the where-clause edges - #814
Merged
Conversation
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.
Two live defects found while reviewing the sprint's work, plus the where-clause edges the review surfaced.
optional payload equality
The widened
T? == Tcompare (#807) — and the pre-existingT? == T?compare — lowered every non-string payload to raw i64 equality. ForBytesand boxed enums the register holds a pointer, so two equal-content values silently compared unequal:ir_emit_inner_value_eq(shared by both compares) now dispatches exactly the way the bare type's==does inir_emit_value_binary: strings through__str_eq, bytes throughbytes_eq, boxed enums through their per-enum structural helper, everything else i64.The generated
__enum_eq_<name>also gained a null guard after its identity fast path: anoneoptional's payload slot hands the helper a 0, and the widened compare reads the slot without branching on the flag — one null side now answers false instead of faulting on the tag read. (bytes_eqwas already null-safe.)where-clause edges
expected kw_fn(E240) becauseparse_fn_signever looked for it. The clause now parses through the sameparse_optional_where_clauseas functions and impl methods. Generic interface members themselves remain unsupported (E202 in the member's body, either bound spelling — pre-existing, now stated in docs/limitations.md); the invalid test pins that the clause reaches E202, not a parse stumble.noticed, not fixed
Generic interface members (E202) and impls on generic instances not satisfying bounds (E226, from #812's review) are both pre-existing, documented, and orthogonal.
what was tested
Bytes?/Bytesboth orders, eq and neq, unequal content,Bytes? == Bytes?, boxed enum with payload and without, and the none-vs-variant case that faulted before the null guard (11 assertions).whereused as an ordinary identifier; golden regenerated.make check-invalid-only(54 passed),make run-regressions-only(371 passed),make bootstrap-verifyfixed point aftermake refresh-bootstrap-seed.