title: Scala type erasure in pattern matching Map[String, Any]
body: <p>I am using scala version 2.12.3, and when I test some pattern match in console code:</p>
  
  <pre><code>val d: Any = Map("1" -&gt; "2", "3" -&gt; 4)
  d match {
      case map: Map[String, Any] =&gt; println(map)
      case _ =&gt; println("should not be here")
  }
  </code></pre>
  
  <p>I got some warning like <code>&lt;console&gt;:14: warning: non-variable type argument String in type pattern scala.collection.immutable.Map[String,Any] (the underlying of Map[String,Any]) is unchecked since it is eliminated by erasure</code>.</p>
  
  <p>I had googled about the warning, and almost all answers are told that scala running time will erase the type when do pattern match, and it seems to be reasonable to answer the question, But when I use the following code:</p>
  
  <pre><code>val e = Map("1" -&gt; "2", "3" -&gt; 4)
  e match {
      case map: Map[String, Any] =&gt; println(map)
      case _ =&gt; println("should not be here")
  }
  </code></pre>
  
  <p>there is not warning about type erase, so what's the difference between this two kinds of pattern matching, and please explain when the type erase will happen, thanks!</p>