Issue #2490: NK2105 inside a lambda names the parameter that may run it again (map may run its lambda more than once)

Open and answer this issue on GitHub.

ready · opened 2026-11-21 · updated 2026-11-21 · 0 comments

Part of #973 After #973

What it is

ADR-lambdas-1 D4: when NK2105 refuses a value moved inside a lambda, the message says why the lambda may run again, naming the parameter: map may run its lambda more than once. Today the reason given is the general “a lambda may run more than once, and the second run would find it gone”, also where the parameter is not once per #973’s contract field. This part needs the once contract field and the checker change of #973.

To build

  1. D4: NK2105 inside a lambda names the parameter that may run it again (map may run its lambda more than once).
  2. Test in tests/compiler/tests/ (Nikaia, with .stderr): the same move as #973’s or_insert_with test, under map, stays NK2105 with the D4 wording.

Done when

A lambda handed to map that moves a captured value is refused with NK2105 whose text names map as running its lambda more than once, shown by a test in tests/compiler/tests/; the commit that builds item 2 carries the Fixes line for this issue.

Split from #973 by Claude Code

Back to Open Issues