null without allocation)Open and answer this issue on GitHub.
language, note · opened 2026-09-30 · updated 2026-10-06 · 2 comments
Record: ADR-246 D5. D1-D4 are built (tests/recursive_types.rs); three refinements are not, in this order:
Expr::Add(Expr::Num(n), b), NK1193 today) rewritten into a match in the arm.null costs no allocation.Item 1 is built in #289 (0.0.306).
A pattern now looks inside a boxed part one level deep. Such an arm is lowered with a guard (matches! over nikaia_std::boxed::peek) and a let … else in the arm, and like a guarded arm it covers no variant on its own (NK1151).
These are still NK1193, each by name: a box inside that part, an | alternative, and a guard that reads a name bound in there.
Left: item 2 (a guard reading a boxed binding as the box; a name used only in the guard is also opened in the body and warned about as unused) and item 3 (Option<Box<T>>).
Generated by Claude Code
Item 2 was built in #307 (0.0.317):
Expr::Add(a, b) if a == Expr::Num(1).Expr::Add(Expr::Num(n), b) if n == 0. That was item 1’s remaining NK1193.Item 3 (Option<Box<T>> for a nullable field) is what remains.
Generated by Claude Code