aboutsummaryrefslogblamecommitdiff
path: root/tests/patmat/t4691.scala
blob: bfaa6167005789a0df6d3d99051271fdf0beadfc (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

















                                                     
sealed trait Node

class NodeType1 (val a:Int) extends Node
class NodeType2 (val b:Int) extends Node

object NodeType1 {
  def unapply (x : NodeType1) : Some[Int] = Some(x.a)
}

object NodeType2 {
  def unapply (x : NodeType2) : Some[Int] = Some(x.b)
}

object Test {
  def test (x: Node) = x match {
    case NodeType1(a) => "got node type 1 " + a
  }
}