Skip to content

Overload resolution with FunctionN as expected type #4831

Closed
@allanrenucci

Description

@allanrenucci
object Test {
  def foo(c: String => Int) = c("Hello")

  def f(x: String): Int = 1
  def f: String => Int = _ => 2

  def main(args: Array[String]): Unit = {
    foo(f) // Dotty: 1, Scala 2: 2
  }
}

Overload resolution differs between Dotty and Scala2. dotc eta-expand the first overload, scalac picks the second overload

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions