A RetroSearch Logo

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

Search Query:

Showing content from https://github.com/scala/scala3/issues/1050 below:

Type projection is unsound · Issue #1050 · scala/scala3 · GitHub

The following program compiles and throws a ClassCastException when executed. One might be tempted to try to rule out the obviously bad intersection T & U but we know from our work on DOT that there are ways to engineer bad bounds that cannot be detected locally. So the culprit is the projection
X#A.

object Test {

  trait C { type A }

  type T = C { type A >: Any }
  type U = C { type A <: Nothing }
  type X = T & U

  def main(args: Array[String]) = {
    val y: X#A = 1
    val z: String = y
  }
}

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