Open pjfanning opened 1 year ago
@odersky do you mind having a look? I'm surprised to see a case where Scala 2 seems to disambiguate overloads (enqueue
is overloaded) better than Scala 3.
The unexpectedly unfortunate overload is deprecated:
def enqueue[B >: A](iter: scala.collection.Iterable[B])
so you get
enqueue[MyByteString | Byte]
The workaround is to be explicit
queue = queue.enqueue[MyByteString](byteString)
@som-snytt that workaround seems to work
It would be nice not to have to use the workaround but it's good that there is an easy one.
Compiler version
Scala 3.3.0
Minimized code
https://scastie.scala-lang.org/pjfanning/nrTQr59WTAy2uIMYUFtkTw/4
This code works in Scala 2.13 but fails to compile in Scala 3.3.0.
A minimised example that reproduces this:
Output
Compiler issue on the
queue = queue.enqueue(byteString)
callExpectation
This should compile.
I think Scala3 is confused by the fact that akka.util.ByteString extends Iterable[Byte] but the Queue is explicitly setup to be Queue[ByteString].