Result: done
Pushed: local 4f716b62a3607d34fdc4ea64b5dd38e09418e274
Tests: tests/compiler –both-settings (543 programs incl. the 2 new); both new shapes failed on the unfixed compiler (scratch probes, same programs: E0308 mismatched types on the taking arm; E0277 &mut i64 == i64); cargo clippy -p nikaia-std -D warnings clean; lower-std fixpoint clean
Deviation: one commit for both defects (check_reads.nika and its lowered file carry both changes, a split would not build alone); the wip was lowered in a scratch sysroot, not built (a build there needs a second target/)
Found: defect 1 fixed: CheckState.a_placeholder now takes the CheckWorld and reads an enum from the file, then the files beside it, then its contract (own, then library); node_id::NodeId counts as defaulted and has impl Default (NodeId::parsed()) in node_id.rs
Found: defect 2 fixed: a name an arm binds in place out of a mut parameter (CheckNarrowing.in_place_refs) makes a match over it bind through the reference, so a Copy part is copied out (let b = *b;); where the outer arm then takes its parts out, the nested arms’ copies are dropped again (in_place_arms)
Found: kind 3, open, blocks the wip’s tr_rewrite_item: a match over a place in a mut parameter (match h.node) whose arm changes a part in place moves the part out (E0507 cannot move out of h.node.items ... behind a mutable reference). Probe: enum Node { Leaf(i64), Many { items: Vec[i64], tag: String } }; struct Held { node: Node }; fn grow(mut h: Held) { match h.node { Node::Many { items, .. } => { for mut one in items { bump(one) } }, else => {} } }
Found: kind 3, open, silent wrong output: a taking arm that writes the mut parameter back on one branch only (if hit { s = Shape::Pair { left: right, right: left, id: id } }) is accepted and leaves the placeholder in s when the branch is not taken (no NK2108). Also s = if c { A } else { B } with the parts is refused NK2108 although both branches give them back
Needs: (wip check) the wip’s three files: tr_field_read and tr_leaving now lower correctly (scratch sysroot: let b = *b;, mem::replace(expr, Expr::LitNull(Default::default()))); tr_rewrite_item still lowers match item.node { Item::Impl { ref target, methods, .. } ... methods.iter_mut() and will fail E0507 (the first open Found above); not built, so other errors may remain
Changelog: Fixed: a taking match arm over an enum another file declares leaves that enum’s placeholder, and a number bound under a match over a part held in place out of a mut parameter is copied out
Note: the lowered files of my five .nika also carry nikaia_std::list::contains lines from another agent’s uncommitted emit change (the binary was built from the shared tree); they compile against HEAD’s std
Files: crates/nikaia-std/src/node_id.rs crates/nikaia-std/src/tools/check_items.nika crates/nikaia-std/src/tools/check_core_flow.nika crates/nikaia-std/src/tools/check_narrow.nika crates/nikaia-std/src/tools/check_reads.nika crates/nikaia-std/src/tools/check_takes.nika crates/nikaia-std/src/tools/lowered/check_items.rs crates/nikaia-std/src/tools/lowered/check_core_flow.rs crates/nikaia-std/src/tools/lowered/check_narrow.rs crates/nikaia-std/src/tools/lowered/check_reads.rs crates/nikaia-std/src/tools/lowered/check_takes.rs tests/compiler/src/taking_beside.nika tests/compiler/tests/a_taking_arm_over_an_enum_declared_beside.nika tests/compiler/tests/a_taking_arm_over_an_enum_declared_beside.stdout tests/compiler/tests/a_copy_bound_under_a_match_on_a_part_of_a_mut_parameter.nika tests/compiler/tests/a_copy_bound_under_a_match_on_a_part_of_a_mut_parameter.stdout tests/compiler/nikaia.contracts tests/compiler/nikaia.derived tests/compiler/nikaia.proofs
Commit: Taking arms over an enum of another file, and Copy parts under a match on an in-place part (#125)
Part: #125
Attribution:
Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01GFeMqxRbtUMiGVyDMxsvEq