A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://issues.scala-lang.org/browse/SI-1503 below:

Casts inserted when pattern matching for equality on singletons are unsound · Issue #1503 · scala/bug · GitHub

I've added a test to pending/run/castsingleton.scala:

object Test extends Application {
  case class L();
  object N extends L();

  def empty(xs : L) : Unit = xs match {
    case x@N => println(x); println(x);
  }

  empty(L())
} 

The problem is that the compiler inserts a cast of xs to N.type, which is unsound: The pattern match will succeed for any L, because N == L().


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4