title: ClassTag based pattern matching fails for primitives
body: <p>I thought the following would be the most concise and correct form to collect elements of a collection which satisfy a given type:</p>
  
  <pre><code>def typeOnly[A](seq: Seq[Any])(implicit tag: reflect.ClassTag[A]): Seq[A] = 
    seq.collect {
      case tag(t) =&gt; t
    }
  </code></pre>
  
  <p>But this only works for <code>AnyRef</code> types, not primitives:</p>
  
  <pre><code>typeOnly[String](List(1, 2.3, "foo"))  // ok. List(foo)
  typeOnly[Double](List(1, 2.3, "foo"))  // fail. List()
  </code></pre>
  
  <p>Obviously the direct form works:</p>
  
  <pre><code>List(1, 2.3, "foo") collect { case d: Double =&gt; d }  // ok. List(2.3)
  </code></pre>
  
  <p>So there must be a (simple!) way to fix the above method.</p>