Scala Mixin SynchronizedSet与具有隐式排序对象的SortedSet

Scala Mixin SynchronizedSet与具有隐式排序对象的SortedSet,scala,collections,implicit,Scala,Collections,Implicit,我似乎无法创建一个也混合在SynchronizedSet中的SortedSet。问题的关键是SortedSet需要一个隐式排序对象 val orderByIdThenName = Ordering[(Int, String)].on[Foo](foo => foo.id -> foo.name) new mutable.TreeSet[Foo]()(orderByIdThenName) // <- Works fine and is Ordered new mutable.Ha

我似乎无法创建一个也混合在SynchronizedSet中的SortedSet。问题的关键是SortedSet需要一个隐式排序对象

val orderByIdThenName = Ordering[(Int, String)].on[Foo](foo => foo.id -> foo.name)
new mutable.TreeSet[Foo]()(orderByIdThenName) // <- Works fine and is Ordered
new mutable.HashSet[Foo] with mutable.SynchronizedSet[Foo] // <- Mixin works
new mutable.TreeSet[Foo]()(orderByCount) with mutable.SynchronizedSet[Foo] // Fail!
val orderByIdThenName=Ordering[(Int,String)]。在[Foo](Foo=>Foo.id->Foo.name)上

new mutable.TreeSet[Foo]()(orderByIdThenName)//这看起来是IntelliJ中的一个bug。我能够重现问题并在编辑器中看到错误,但在编译时没有错误或警告

因为没有给出orderByCount的定义,所以我假设它类似于:

val orderByCount = Ordering[Int].on[Foo](_.count)
new mutable.TreeSet[Foo]()(orderByCount) with mutable.SynchronizedSet[Foo]
更新: 提出了一种通过重写
排序来消除IntelliJ中错误的方法:

new mutable.TreeSet[Foo]()(orderByCount) with mutable.SynchronizedSet[Foo] {
    implicit override val ordering: Ordering[Foo] = orderByCount
}

很好,谢谢。是的,它看起来像一个IntelliJ bug。