Skip to content

Commit

Permalink
Drop override in SeqFactory
Browse files Browse the repository at this point in the history
Another method that was added for the typesafety demonstration, which should be removed now.
  • Loading branch information
odersky committed Mar 2, 2024
1 parent 1ef2574 commit 4464a73
Showing 1 changed file with 0 additions and 9 deletions.
9 changes: 0 additions & 9 deletions scala2-library-cc/src/scala/collection/Factory.scala
Original file line number Diff line number Diff line change
Expand Up @@ -296,21 +296,12 @@ object IterableFactory {
}
}

// !!! Needed to add this separate trait
//trait FreeSeqFactory[+CC[A]] extends IterableFactory[CC]:
// def from[A](source: IterableOnce[A]^): CC[A]
// override def apply[A](elems: A*): CC[A]

// type FreeSeqFactory[+CC[A] <: SeqOps[A, Seq, Seq[A]]] = SeqFactory[CC]

/**
* @tparam CC Collection type constructor (e.g. `List`)
*/
trait SeqFactory[+CC[A] <: SeqOps[A, Seq, Seq[A]]] extends IterableFactory[CC] {
import SeqFactory.UnapplySeqWrapper
final def unapplySeq[A](x: CC[A] @uncheckedVariance): UnapplySeqWrapper[A] = new UnapplySeqWrapper(x) // TODO is uncheckedVariance sound here?
def from[A](source: IterableOnce[A]^): CC[A]
override def apply[A](elems: A*): CC[A] = from(elems)
}

object SeqFactory {
Expand Down

0 comments on commit 4464a73

Please sign in to comment.