Open MasseGuillaume opened 6 years ago
I think a cross-compatible workaround would be to explicitly upcast the sorted set: (TreeSet(1, 2): Set[Int]).map(f)
I think this is cleaner:
import compat._
TreeSet(1, 2).unsorted.map(f)
Unfortunately, this rewrite is going to be in the Experimental. Once again we hit https://github.com/scalameta/scalameta/issues/1212.
Sorted collection have a special map functions that takes an ordering. The fallback map
is defined in, for example, SetLike.map
. We cannot make the difference between BitSet(1).map(f)
and Set(1).map(f)
since we don't know the type of the lhs (BitSet(1): BitSet
and Set(1): Set[Int]
). I think the short term solution for us is to fork scalameta's semanticdb.
I see. OK.
Labeling as library
. Adding the unsorted
method in 2.12 should be the easiest solution for now.
SortedSet.map
in 2.12 returns aSet
if it cannot find an implicit Ordering. To keep this behavior in 2.13, you can useunsorted
. However, this method is not available in 2.12.