Skip to content

EtaExpand can produce code that does not compile when there is a SAM conversion #319

@eejbyfeldt

Description

@eejbyfeldt

The following code

trait TC[X] {
  def gen(r: Int): X
}

val gen: Int => Int = ???
val tc: TC[Int] = x => gen(x)

get rewritten to

trait TC[X] {
  def gen(r: Int): X
}

val gen: Int => Int = ???
val tc: TC[Int] = gen

That does not compile due to

     Found:    (gen : Int => Int)
     Required: TC[Int]

Seems like one might need semantic information to detect and fix this case, but I am not sure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions