title: Constructor cannot be instantiated to expected type; p @ Person
body: <p>I am using scala version : <code>Scala code runner version 2.9.2-unknown-unknown -- Copyright 2002-2011, LAMP/EPFL</code></p>
  
  <p>I was trying the deep case matching construct from here: <a href="http://ofps.oreilly.com/titles/9780596155957/RoundingOutTheEssentials.html" rel="noreferrer">http://ofps.oreilly.com/titles/9780596155957/RoundingOutTheEssentials.html</a> and the code is as follows <code>match-deep.scala</code>:</p>
  
  <pre><code>class Role
  case object Manager extends Role
  case object Developer extends Role
  
  case class Person(name:String, age: Int, role: Role)
  
  val alice = new Person("Alice", 25, Developer)
  val bob = new Person("Bob", 32, Manager)
  val charlie = new Person("Charlie", 32, Developer)
  
  for( person &lt;- List(alice, bob, charlie) ) {
    person match {
      case (id, p @ Person(_, _, Manager)) =&gt; println("%s is overpaid".format(p))
      case (id, p @ Person(_, _, _)) =&gt; println("%s is underpaid".format(p))
    }
  }
  </code></pre>
  
  <p>I am getting following errors:</p>
  
  <pre><code>match-deep.scala:13: error: constructor cannot be instantiated to expected type;
   found   : (T1, T2)
   required: this.Person
      case (id, p @ Person(_, _, Manager)) =&gt; println("%s is overpaid".format(p))
           ^
  match-deep.scala:13: error: not found: value p
      case (id, p @ Person(_, _, Manager)) =&gt; println("%s is overpaid".format(p))
                                                                              ^
  match-deep.scala:14: error: constructor cannot be instantiated to expected type;
   found   : (T1, T2)
   required: this.Person
      case (id, p @ Person(_, _, _)) =&gt; println("%s is underpaid".format(p))
           ^
  match-deep.scala:14: error: not found: value p
      case (id, p @ Person(_, _, _)) =&gt; println("%s is underpaid".format(p))
  </code></pre>
  
  <p>What am I doing wrong here?</p>