Skip to content

fix the "Factory" type alias definition #152

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 4, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ private[compat] trait PackageShared {
* @tparam A Type of elements (e.g. `Int`, `Boolean`, etc.)
* @tparam C Type of collection (e.g. `List[Int]`, `TreeMap[Int, String]`, etc.)
*/
type Factory[-A, +C] <: CanBuildFrom[Nothing, A, C] // Ideally, this would be an opaque type
type Factory[-A, +C] = CanBuildFrom[Nothing, A, C] // Ideally, this would be an opaque type

implicit class FactoryOps[-A, +C](private val factory: Factory[A, C]) {

Expand Down
16 changes: 16 additions & 0 deletions compat/src/test/scala/test/scala/collection/NoImportTest.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package test.scala.collection

// Don't import scala.collection.compat._
import scala.collection.compat.Factory
import scala.collection.{mutable, immutable}

class NoImportTest {

implicitly[Factory[Int, List[Int]]]
implicitly[Factory[Char, String]]
implicitly[Factory[Char, Array[Char]]]
implicitly[Factory[Int, collection.BitSet]]
implicitly[Factory[Int, mutable.BitSet]]
implicitly[Factory[Int, immutable.BitSet]]

}