title: Scala Type Erasure on Option Match
body: <pre><code>object Test {
    def main(args: Array[String]) {
      val list: List[Double] = List(1.0, 2.0, 3.0, 4.0)
      val none = None
  
      case class Test()
  
      val test = Test()
  
      def f(x: Any) = x match {
          case _: Some[Test] =&gt; println("_ matched")
          case None =&gt; println("None matched")
      }
  
      f(list)
      f(none)
      f(test)
    }
  }
  </code></pre>
  
  <p>Trying to compile the above code leads to an "eliminated by erasure" compile-time warning.</p>
  
  <pre><code>   $&gt;scalac Test.scala
      Test.scala:11: warning: non-variable type argument Test in type pattern
   Some[Test] is unchecked since it is eliminated by erasure
              case _: Some[Test] =&gt; println("_ matched")
                      ^
      one warning found
  </code></pre>
  
  <p>I read this highly regarded Stackoverflow <a href="https://stackoverflow.com/questions/1094173/how-do-i-get-around-type-erasure-on-scala-or-why-cant-i-get-the-type-paramete">post</a>, but I don't understand the type erasure here.</p>