Skip to content

GADT, pattern matching anon fun inference regression #10085

Open
@scabug

Description

@scabug
sealed trait Op[A]
case class IntOp(i: Int) extends Op[Int]

object Test {
  def run[A](op: Op[A]): Int => A = op match {
    case IntOp(i) => 
      {case x => i} // broken
  }
  // def runOkay[A](op: Op[A]): Int => A = op match {
  //   case IntOp(i) =>
  //     x => i // okay
  // }
}

This no longer typechecks ("found A required Int"). I bisected the regression to http://github.com/scala/scala/pull/4971, support for SAM types.

Metadata

Metadata

Assignees

No one assigned

    Labels

    fixed in Scala 3This issue does not exist in the Scala 3 compiler (https://github.com/lampepfl/dotty/)gadtregressiontyper

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions