Skip to content

Parameter untupling and automatic eta-expansion don't always mix #11185

Closed
@Jasper-M

Description

@Jasper-M

Minimized code

def foo(a: Int, b: Int) = a + b

Map(1 -> 2).map(foo _) // ok: List(3)

Map(1 -> 2).map(foo) // error

Output

Map(1 -> 2).map(foo)
^^^^^^^^^^^^^^^
None of the overloaded alternatives of method map in trait IterableOps with types
 [B](f: ((Int, Int)) => B): scala.collection.immutable.Iterable[B]
 [K2, V2](f: ((Int, Int)) => (K2, V2)): Map[K2, V2]
match arguments ((foo : (a: Int, b: Int): Int))

Expectation

Since the compiler can pick the right overload with explicit eta-expansion, I don't see why he can't do that with automatic eta-expansion.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions