title: How can I match classes in a Scala "match" statement?
body: <p>How can I use a "match" statement to identify the value of a class variable?  The following is invalid, and I can't find an acceptable variant -- other than if ... else if ... else ...</p>
  
  <pre><code>val c: Class[_] = classOf[Int]
  val what = c match { case classOf[Int] =&gt; "int!"; case classOf[Float] =&gt; "float!" }
  </code></pre>
  
  <p>The compiler complains: <code>error: not found: type classOf</code></p>
  
  <p>And of course, I can't use <code>Class[Int]</code> because that type information is erased:</p>
  
  <pre><code>c match { case Class[Int] =&gt; "int!"; case Class[Float] =&gt; "float!" }
  error: type Class of type Class does not take type parameters.
  </code></pre>
  
  <p>I've also tried variants like <code>Int.class</code>, all to no avail.  (And I don't really want to convert to strings: I feel it's important to have the compiler catch renamed/moved classes.)</p>
  
  <p>Am I being dense, or have I stumbled into a Scala blind spot?</p>