Scala 3.1.2 change - String no longer working with SeqOps

Hi all,

I have found 3.1.2 does not compile some code that was working with 3.1.1 and before.

Reduced the issue to the following snippet:

It works if you run it with Scala 3.1.1, but it fails to work on a String with 3.1.2RC1 (but also with the final release not available yet on Scastie).

@nicolasstucki maybe this is something you can help me understand?

Thank you in advance,

Mario

1 Like

@mcallisto could you open an issue Issues · lampepfl/dotty · GitHub?

I also noticed that the issue is not only on extension methods.

import scala.collection.SeqOps
def foo[A, CC[B] <: SeqOps[B, CC, CC[B]]](seq: CC[A]): CC[A] = seq.tail
def test: Unit = foo("ABC")

It seems to be related with the implicit conversion from String into Seq[Char]. Making the conversion more explicit fixes the issue.

def test2: Unit = foo("ABC": Seq[Char])

@nicolasstucki thank you for the quick reply!

I will open an issue later today.

Done, see String no longer taken as generic SeqOps · Issue #14927 · lampepfl/dotty · GitHub

1 Like