Open and answer this issue on GitHub.
bug, ready · opened 2026-11-29 · updated 2026-11-29 · 0 comments
fn main() throws {
let xs = [1, 2, 3]
let ys = [4, 5, 6]
let a = xs.iter().zip(ys.iter()).map(fn(p) { p.0 + p.1 }).sum()
println(f"{a}")
}
This gives NK1245 (“The compiler can’t tell what type p.0 is”). It fails the same way on c2554dfb and on the tree of the second run of “Chains over lists, maps and std’s other producers are one loop the compiler writes, and seq.rs leaves Rust (ADR-chain-loop-v1 D6, D7)” (#2927). A for (x, y) over the same zip runs.
The program prints 21, just as xs.iter().enumerate().map(fn(p) { p.0 + p.1 }).sum() types its pair. The signature of Seq::zip in std.contracts, [T, U](self: Seq[T], other: Seq[U]) -> Seq[(T, U)], names the pair’s type.
Unknown. Possibly the checker binds the lambda’s parameter before it takes U from the argument. To check: print the receiver’s Seq item type at the map call.
zip’s pairs gets the type (T, U)..stdout.The probe prints 21.
Found during #2927.