How to deal with "changed semantics" warning?

We use Scala 2.12.13 and SBT 1.4.7.

I’m getting the warning that "method values in trait MapLike has changed semantics in version 2.8.0:
values returns Iterable[V] rather than Iterator[V]".

So I thought I’d spell it out:

val things: scala.collection.immutable.IndexedSeq[SomeThing] = ...
val x: Iterable[scala.collection.immutable.IndexedSeq[SomeThing]] =
        things.groupBy(thing => thing.id_thing).values

but I still get the warning (on “values” in the third line).

What (more) should I do to silence this warning?

I found a way to solve my immediate problem by using “valuesIterator” instead of “values” but I’d still like to understand why the warning remains in the above code.

The warning is issued as soon as you use the .values method, since it is annotated with a @migration note.

See scala/src/library/scala/annotation/migration.scala at 60b503bcfdd61e086fa6b978c38009f2604dd365 · scala/scala · GitHub

You could suppress all migration warnings when using the -Xmigration compiler flag; just give it a version number >= 2.8.0.

I have been using

scalacOptions ++= Seq(
    <snip/>
    "-Xmigration", "2.12.13",
    <snip/>
)

but I have now tried ">=2.8.0", ">2.8.0", and ">=2.12.13" but I get the same result everywhere.

Am I misunderstanding you?

The synopsis is:

$ scalac -X
...
-Xmigration:<version>            Warn about constructs whose behavior may have changed since version.

So, it should work with -Xmigration:2.8 for example. And you can also give the special value none to see no migration warnings at all.

I see. That contradicts what I see at https://docs.scala-lang.org/overviews/compiler-options/index.html there it says:

-Xmigration VERSION
Warn about constructs whose behavior may have changed since version.

Default: none

No colon. It’s unfortunate that we are (or at least appear to be) so inconsistent; some flags need a colon others don’t.

Any idea why SBT/scalac did not die with an error or at least showed a warning? That would have saved me quite a bit of time.

In any case, thank you very much. You’ve saved what’s left of my hair. :wink: