Compiler version
ba45875
Minimized code
def bar[A](f: A => Unit): A = ???
def foo[A, U](f: A => U): A = bar(f)
Output
-- [E007] Type Mismatch Error: test.scala:2:34 ---------------------------------
2 |def foo[A, U](f: A => U): A = bar(f)
| ^
| Found: (f : A => U)
| Required: A => Unit
|
| longer explanation available when compiling with `-explain`
Expectation
Should compile. It was mentioned during our lab meeting last week that we do perform adaptation after eta-expansion.
Notes
If we expand manually, the code compiles.
def bar[A](f: A => Unit): A = ???
def foo[A, U](f: A => U): A = bar(x => f(x))