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
scala> new MySeq(Seq(1, 2, 3))
val res0: test.MySeq[Int] = Seq(1, 2, 3)
scala> res0 map(_ + 1)
java.lang.ClassCastException: scala.collection.immutable.$colon$colon cannot be cast to test.MySeq
expectation
In Scala 2.13.1 it does not compile:
[error] [...] incompatible type in overriding
[error] def iterableFactory: scala.collection.IterableFactory[[_]test.MySeq[_]] (defined in trait IterableOps)
[error] with override def iterableFactory: scala.collection.SeqFactory[scala.collection.Seq] (defined in trait Seq);
[error] found : => scala.collection.SeqFactory[scala.collection.Seq]
[error] required: => scala.collection.IterableFactory[[_]test.MySeq[_]];
[error] other members with override errors are: fromSpecific, newSpecificBuilder, empty
[error] class MySeq[A](private val underlying: Seq[A])
The text was updated successfully, but these errors were encountered:
minimized code
The following compiles in Dotty 0.19.0-RC1:
but gives
ClassCastException
at runtime:expectation
In Scala 2.13.1 it does not compile:
The text was updated successfully, but these errors were encountered: