Repository navigation
fix: narrow nullable scalar switch once - #18
fullofcaffeine wants to merge 3 commits into
Conversation
Haxe rewrites a nullable scalar switch into a null test and a local alias in the present branch. The old Rust lowering tested the same Option again and kept a dead, catchable Null Access throw. Recognize that exact typed shape for Copy scalar values and emit one Option match. Portable and metal snapshots now cover Int and Float values, including both present and null cases. Verified with the focused snapshot and Clippy gate, adjacent nullable and switch snapshots, repository hooks, root Cargo formatting, and root Clippy with warnings denied. Other nullable shapes keep the existing checked lowering.
The nullable switch compiler change moved one reviewed raw Rust call site without changing its ownership or authority. Refresh the generated inventory so hosted snapshot jobs can confirm the current source location. The factory, authority, reason, owner, boundaries, and inventory counts are unchanged. Verified with the raw-authority test, its hello snapshot, the focused portable and metal nullable snapshots with Clippy, the raw-authority guard, and the pre-commit evidence wiring test.
Hosted snapshot repairThe hosted snapshot jobs found a stale generated inventory after the compiler edit moved source lines. The documented sync changed one reviewed call-site line from The factory, authority, reason, owner, boundaries, and inventory counts remain unchanged. Exact replacement head: Verification at this head:
The earlier local report used The isolated worktree also disabled Git hooks during creation, as required. Therefore, the commit did not invoke the project pre-commit hook. The project pre-commit hook selects the raw-authority test when compiler source changes. I missed that separate hook path in the first verification pass. The haxe.rust compiler agent retains ownership of review fixes and rebasing for Other agents must not modify this branch without a recorded handoff. |
A nullable scalar switch could become an outer null check followed by a second Option match. The second match kept a dead Null Access throw in generated Rust. Recognize the same compiler-generated alias shape when its final local sits inside transparent one-item blocks. Emit one Option match, while keeping all existing source-local, type, and Copy-value checks. The portable and metal snapshots cover direct Int and Float switches plus a called try-and-close flow that produces the nested alias shape. Focused generation, formatting, Cargo build, Clippy, snapshot comparison, and the corrected codex-hxrust consumer replay pass. The full harness passed all guards and 31 semantic-difference cases. Six unrelated semantic-difference cases exceeded the fixed 180-second timeout on the contended host.
Replacement head and consumer proofExact head: The final patch keeps one narrow compiler owner. It only peels transparent one-item blocks around the alias tail of the existing nullable scalar pattern. The portable and metal regression snapshots passed generation, rustfmt, Cargo build, Clippy, and golden-output comparison.
The full hook command reached the complete harness. All repository guards passed first. The harness passed 31 of 37 semantic-difference cases. These six cases exceeded the fixed 180-second timeout on the contended host:
No harness assertion, compiler diagnostic, Cargo error, or runtime error failed in those cases. The corrected unchanged codex-hxrust replay used selector commit The generated process-exit block now has:
The disposable generated crate passed rustfmt, Whole-crate consumer Clippy still reports approximately 7,005 existing style warnings. I do not claim that check passed. Prepared by the haxe.rust compiler agent for Final approval and merge remain maintainer-only. This PR stays draft and unmerged. |
|
Landing dependency update: PR #19 fixes the newly reported fast-uri audit failure, but its two snapshot jobs were cancelled at the exact 60-minute workflow ceiling while still advancing through late curated Clippy cases. PR #20 is a focused stacked change that raises only that ceiling and its contract to 90 minutes.\n\nRequired order remains maintainer-controlled: merge PR #20 into PR #19, require PR #19 exact-head hosted green, merge PR #19 into main, then rebase this semantic PR and require all checks green again. This PR remains draft and must not be pinned by consumers before its eventual merged commit is replayed. |
Why
Haxe can rewrite a nullable scalar switch into a null test and a local alias.
The old Rust output tested the same
Optionagain in the present branch. It also kept a dead, catchableNull Accessthrow.This output was harder to read and did more work than one native Rust match.
What changed
The compiler now accepts the same exact alias shape when transparent one-item blocks wrap its final local.
It emits one
Optionmatch and binds the present payload directly:The recognizer still requires the same source local, alias identity, result type, and Copy scalar type. Other nullable shapes keep the existing checked lowering.
The generic snapshot covers direct
Null<Int>andNull<Float>switches. It also covers a called try-and-close flow that produces the nested alias shape.This change adds no runtime support.
Before and after
The base commit emitted an outer
is_none()guard. Its present branch matched the sameOptionand kept a deadNull Accessthrow.The new output evaluates the nullable value once. One match handles both
NoneandSome.Verification
npm run test:rust-raw-authoritypassed, including thehello_tracesnapshot.14d133cand this compiler worktree.match exit.exit.is_none,__hx_opt, or nullableNull Accessbranch.cargo check --locked,cargo test --locked, and thetui-prompt-submit-enveloperuntime gate.Tracking
Issue:
haxe_rust-4tc8Base:
b4975cb3bc0039cfabf498e455cbab4e36de58deCurrent head:
b3b60a22dea562caef7551e3ca2b08d9074af86dAgent provenance
Prepared by the haxe.rust compiler agent after codex-hxrust exposed
haxe_rust-4tc8through a real process-exit switch.The compiler agent owns review fixes and rebasing for this branch. Final approval and merge remain maintainer-only.
Other agents must not modify this branch without a recorded handoff.