scala3 icon indicating copy to clipboard operation
scala3 copied to clipboard

Incorrect error message during eta-expansion

Open Sporarum opened this issue 3 years ago • 0 comments

Compiler version

scalaVersion = 3.2.1-RC1 / 3.2.0

Minimized code & Output

def foo(x: Int)(y: String): Int = x

val voo: (Int, String) => Int = foo // error:  
// Found: String => Int
// Required: Int

https://scastie.scala-lang.org/LvKVtDGbSJ2SKl4dpHH92w

Which seems to suggest def foo(x: Int): Int would have the correct signature, which is wrong

Expectation

A similar error to what is done with a function on the RHS:

def foo(x: Int)(y: String): Int = x

val voo: (Int, String) => Int = (foo: Int => String => Int) // error:
// Found:    Int => String => Int
// Required: (Int, String) => Int

https://scastie.scala-lang.org/9WE77Zj1Temgx92F4l5gKA

Sporarum avatar Sep 22 '22 11:09 Sporarum