Skip to content

regression on eta expansion of vararg methods #14367

Closed
@bjornregnell

Description

@bjornregnell

Compiler version

3.1.1

Minimized code and output

Welcome to Scala 3.1.1 (11.0.13, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.
                                                                                                                               
scala> def m(i: Int*) = i.sum
def m(i: Int*): Int
                                                                                                                               
scala> val f = m _
-- [E081] Type Error: ---------------------------------------------------------------------------------------------------------
1 |val f = m _
  |        ^
  |        Missing parameter type
  |
  |        I could not infer the type of the parameter i.
1 error found

But it works if the type is given explicitly:

scala> val f: Seq[Int] => Int = m
val f: Seq[Int] => Int = Lambda$1433/0x0000000800768840@434d001d

Expectation

It works in Scala 2 so this is a regression:

Welcome to Scala 2.13.8 (OpenJDK 64-Bit Server VM, Java 11.0.13).
Type in expressions for evaluation. Or try :help.

scala> def m(i: Int*) = i.sum
def m(i: Int*): Int

scala> val f = m _
val f: Seq[Int] => Int = $Lambda$1132/0x00000001006bf040@4def7d36

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions