```scala object Test { def main(args: Array[String]): Unit = { ("": Any) match { case a @ Test => 1 case _ => 2 } } } ``` Will fail at runtime when the matched string is casted to `Test` (which should not happen) The pattern match is expanded to the following code after `patternMatcher` ``` { case val x1: Any = "": Any case val a: Test.type = x1.asInstanceOf[Test.type] if Test.==(x1) then { println(1) } else { println(2) } } ``` Clearly the `case val a: Test.type = x1.asInstanceOf[Test.type]` should go inside the `if Test.==(x1) then`