blob: d51cdc65dbf5da81e73cd84b9e0aedaa64ff6bee (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
trait Break { protected val break: Int; }
case class BreakImpl(protected val break: Int) extends Break {}
object Test {
def f2(x: Break) = x match {
case BreakImpl(x) => BreakImpl
case _ => -1
}
def f4(x: Any) = x match {
case BreakImpl(x) => x
case _ => -1
}
def main(args: Array[String]): Unit = {
val break = BreakImpl(22)
assert(f2(break) == 22)
assert(f4(break) == 22)
}
}
|