scala / collection-strawman

Implementation of the new Scala 2.13 Collections
Apache License 2.0
200 stars 72 forks source link

BitSet doesn't know whether to become sorted or not on map to non-Int #508

Closed Ichoran closed 6 years ago

Ichoran commented 6 years ago
scala> val b = strawman.collection.immutable.BitSet(1)
b: strawman.collection.immutable.BitSet = BitSet.BitSet1(1)

scala> b.map(i => i.toLong)
         ^
       error: ambiguous reference to overloaded definition,
       both method map in trait StrictOptimizedIterableOps of type [B](f: Int => B)strawman.collection.immutable.Set[B]
       and  method map in trait SortedSetOps of type [B](f: Int => B)(implicit evidence$4: Ordering[B])strawman.collection.immutable.SortedSet[B]
       match argument types (Int => Long)
szeiger commented 6 years ago

Needs a dummy override to fix the priorities. It should always pick the SortedSet version (because there is no way to do it more intelligently based on the presence of a ClassTag).