Skip to content

Eta expansion difference to scalac #2009

Closed
@felixmulder

Description

@felixmulder

Scalac is happy to compile the code below:

object Test {

  trait Gen[T] {
    def map[U](f: T => U): Gen[U] = ???
  }

  def f[T](implicit g: Gen[T]): Gen[() => T] =
    g map ( () => _ )
}

whereas dotty fails with:

-- Error: local/func0.scala ----------------------------------------------------
8 |    g map ( () => _ )
  |                  ^
  |    missing parameter type for parameter _$1, expected = Test.Gen[() => T]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions