Closed
Description
reproduction steps
using Scala 2.13.6
,
scala> val f = (a: Unit) => println(s"Received $a")
val f: Unit => Unit = $Lambda$2279/411876574@4ee6291f
scala> f("foo", "bar", "baz")
Received ()
problem
The compiler should not allow the arguments ("foo", "bar", "baz")
to be passed to a function that expects one Unit
argument. This is particularly problematic for higher-order functions that may return a unary A => Unit
function, with A
being Unit
in situations where the first function argument is irrelevant.