You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This exploits a hole similar to the examples in #7278, but all of those use type members. Maybe it seems more serious if it can easily arise with the more frequently used type parameters.
classCovariant[+A](valx:A)
traitInvariant[A] extendsCovariant[A]
objectFooextendsCovariant[Any]("abc") withInvariant[Int] { defapply(x: Int):Int= x *7 }
objectBar { defmain(args: Array[String]) { Foo(Foo.x) } }
// java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer// at scala.runtime.BoxesRunTime.unboxToInt(BoxesRunTime.java:105)// at Bar$.main(a.scala:4)// at Bar.main(a.scala)
This exploits a hole similar to the examples in #7278, but all of those use type members. Maybe it seems more serious if it can easily arise with the more frequently used type parameters.
The base type sequence of Foo.type is
The text was updated successfully, but these errors were encountered: