blob: 975ec58db8234da53ac82eedc540088a9c624eda (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
final class Foo(val value: Int)
object Foo {
def unapplySeq(foo: Foo): Some[Seq[Int]] = Some(List(foo.value))
// def unapply(foo: Foo): Some[Int] = Some(foo.value)
}
sealed trait Tree
case class Node1(foo: Foo) extends Tree
case class Node2() extends Tree
object Test {
def transformTree(tree: Tree): Any = tree match {
case Node1(Foo(1)) => ???
}
}
|