aboutsummaryrefslogtreecommitdiff
path: root/tests/patmat/t8511.scala
blob: bc7f64713441d6010daa052614ac2e117a2285c9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
sealed trait Expr
final case class Foo(other: Option[String]) extends Expr
final case class Bar(someConstant: String) extends Expr
final case class Baz() extends Expr
final case class EatsExhaustiveWarning(other: Reference) extends Expr

sealed trait Reference {
  val value: String
}

object Reference {
  def unapply(reference: Reference): Option[(String)] = {
    Some(reference.value)
  }
}

object EntryPoint {
  private def logic(head: Expr): String = head match {
    case Foo(_) =>
      ???
    // Commenting this line only causes the exhaustive search warning to be emitted
    case EatsExhaustiveWarning(Reference(text)) =>
      ???
  }
}