Skip to content

Missing *ToCBF #103

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

Closed
MasseGuillaume opened this issue Jul 19, 2018 · 1 comment
Closed

Missing *ToCBF #103

MasseGuillaume opened this issue Jul 19, 2018 · 1 comment
Milestone

Comments

@MasseGuillaume
Copy link
Contributor

MasseGuillaume commented Jul 19, 2018

The following gives compilations errors in 2.12:

type mismatch;
[error]  found   : scala.collection.mutable.TreeMap.type
[error]  required: scala.collection.generic.CanBuildFrom[Nothing,Int,?]
import scala.collection.compat._

{
  import scala.collection.immutable._
  List(1).to(::)
  List(1).to(HashMap)
  List(1).to(IntMap)
  List(1).to(ListMap)
  List(1).to(LongMap)
  List(1).to(Map)
  List(1).to(Nil)
  List(1).to(NumericRange)
  List(1).to(PagedSeq)
  List(1).to(Range)
  List(1).to(SortedMap)
  List(1).to(StringLike)
  List(1).to(StringOps)
  List(1).to(TreeMap)
  List(1).to(WrappedString)
}

{
  import scala.collection.mutable._
  List(1).to(AnyRefMap)
  List(1).to(ArrayBuilder)
  List(1).to(ArrayOps)
  List(1).to(ObservableBuffer)
  List(1).to(PriorityQueue)
  List(1).to(UnrolledBuffer)
  List(1).to(WrappedArray)
  List(1).to(HashMap)
  List(1).to(History)
  List(1).to(IndexedSeqView)
  List(1).to(LinkedHashMap)
  List(1).to(ListMap)
  List(1).to(LongMap)
  List(1).to(Map)
  List(1).to(MultiMap)
  List(1).to(OpenHashMap)
  List(1).to(SortedMap)
  List(1).to(TreeMap)
  List(1).to(WeakHashMap)
}

I think IntMap could be implemented like this:

implicit def intMapCompanionCBF[A](fact: i.IntMap.type): CanBuildFrom[Any, (Int, A), i.IntMap[A]] =
  simpleCBF(i.IntMap.canBuildFrom[Any, A]())
@MasseGuillaume
Copy link
Contributor Author

It's not possible to create those via the old .to[CC] syntax.

List((1, 1)).to[Map]
//error: Map takes two type parameters, expected: one
       List((1, 1)).to[Map]
                       ^

This bug is invalid.

martijnhoekstra pushed a commit to martijnhoekstra/scala-collection-compat that referenced this issue Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants