Skip to content

Missing adaptation from by-name to result type #4558

Closed
@gsps

Description

@gsps

When using a valdef to unapply a by-name parameter, we don't insert the required adaptation, leading to a runtime exception:

object Foo {
  def f(z: => (Int, String)) = {
    val (x, y) = z
  }
}

object HelloWorld { def main(args: Array[String]): Unit = { Foo.f { (1, "a") } } }

results in

java.lang.ClassCastException: scala.Tuple2 cannot be cast to scala.Function0

in the body of f.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions