Skip to content

E0951 refuses it * it: a second use of the implicit parameter is read as a nested closure #2545

Closed

Description

@ehartford

it * it (the implicit parameter used twice in one closure body) is refused as a nested implicit closure:

fn main:
    let xs = [1, 2, 3]
    let sq = xs |> map(it * it) |> collect[List]()
    print(f"{sq[2]}")

v0.15.3.0-g5e0bd9076:

error: nested implicit closure is ambiguous; use explicit parameter for inner closure [E0951]
 --> it_it.w:3:29
3 |     let sq = xs |> map(it * it) |> collect[List]()
  |                             ^^

E0951 (§9, §29.12) is for an implicit it inside a closure nested in another implicit closure. it * it has one closure and one it, used twice: the second use must read the same parameter. Expected: 9. The same body spelled x => x * x works.

Activity

  1. ehartford commented on Oct 23, 2026

    @ehartford
    ContributorAuthor

    Fixed on main (b050a01, PR #2587, stack #2588): one commit with the fixture test/behavior/behav_2545_it_closure_per_argument.w, which failed before the fix and passes after; battery GREEN on the stack top 077d684 (669 s, pinned seed nightly-20261023-local-1).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions