Skip to content

Ignored parameter (_) in context function is still in implicit scope #23144

Open
@mrdziuban

Description

@mrdziuban

Compiler version

3.3.6, 3.4.3, 3.5.2, 3.6.4, 3.7.0, and latest nightly 3.7.2-RC1-bin-20250510-f784625-NIGHTLY

Minimized code

def foo[A](f: Int ?=> A): A = f(using 1)
def bar(using i: Int): Int = i
val x = foo(_ ?=> bar)

Output

val x: Int = 1

Expectation

Since the argument of the context function passed to foo is ignored with _, I expected a compiler error as if I had called bar with no given Int in scope, e.g.

scala> bar
-- [E172] Type Error: ----------------------------------------------------------
1 |bar
  |   ^
  |   No given instance of type Int was found for parameter i of method bar

Metadata

Metadata

Assignees

No one assigned

    Labels

    itype:bugstat:needs triageEvery issue needs to have an "area" and "itype" label

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions