[1, 2, 3].iter().filter(fn(x) { x > 1 }) on a list literal of open numbers reaches rustc (no copied walk)Open and answer this issue on GitHub.
ready, wip · opened 2026-10-31 · updated 2026-10-31 · 0 comments
Found by s1082 (report docs/briefs/s1082-or-default-cloned.md.report.md), reproduced on develop 0d8deb1f.
fn main() {
let c = [1, 2, 3].iter().filter(fn(x) { x > 1 }).count()
print(c)
}
rustc: expected &&_, found integer at x > 1; the lowering is vec[1, 2, 3].iter().filter(|x| { x > 1 }). The same chain over a local (let ys = [1, 2, 3] then ys.iter()...) lowers to ys.iter().copied().filter(|&x| ...) and prints 2; so does a typed let xs: Vec[i64]. .sum() into let s: i64 fails the same way.
check_core_method.nika, the walk branch after check_core_method_resolved (around :620): for a Seq of an open number, copied_walks is set only when walk_open != null && state.flow.walk_view. For a list literal as the receiver of iter() these are not set (the literal is no variable whose open number is tracked), so neither .copied() nor |&x| is written. Emitter side: emit_core_calls.nika reads copied_walks (:1514).
iter() makes a copied walk like a local does (ADR-231 D1, #594).tests/compiler/tests/literal_list_walk_copied.nika + .stdout: the probe, .sum() into let s: i64, and .map(fn(x) { x * 2 }) over [1, 2].iter().Generated by Claude Code