Getting MatchError when using a placeholder for an unused variable
问题 With Scala 2.13.x, I am getting scala.MatchError: null when I use a placeholder for an unused variable: scala> object Test { | val _: Any = null | } object Test scala> Test scala.MatchError: null ... 41 elided But with Scala 2.12.x, I am not getting scala.MatchError: null : scala> object Test { | val _: Any = null | } defined object Test scala> Test res1: Test.type = Test$@784c5ef5 Any reason? 回答1: As stated in scala 2.13 release notes: Underscore is no longer a legal identifier unless