Skip to content

Compiler hangs in nested pattern match #13151

@szeiger

Description

@szeiger

This is as far as I could minimize it. All remaining parts appear to be necessary:

object Test {
  class A[+V]
  case class B[V](value: C[V]) extends A[V]
  class C[A](val value: A)

  def f[V](a: A[V]): Unit =
    a match {
      case B(c: C[V]) => c.value match { case _: String => }
    }
}

The compiler hangs in typer. Reproduced with 2.12.20, 2.12.21, 2.13.16, 2.13.18. I remember seeing a bug involving a nested pattern match that required types with certain variance before, but I can't remember the details and I didn't find it in the bug tracker.

It compiles in 3.7.4.

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/)patmat

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions