
"Before (3.7): A synthetic tuple-producing map was inserted; that step could make Map select a generic map overload and become an Iterable (e.g. List) In 3.8: That synthetic step is removed, so the conversion no longer happens and a different map/flatMap path can be selected."
"The following code snippet behaves differently at runtime depending on Scala version used for compilation. In Scala 3.7.x and earlier it produces List((43,29), (43,30), (43,31)), but starting with 3.8 it results in Map(43 -> 31)."
"The previous runtime behaviour can be achieved by explicitly converting first Map to Iterable type or by compilation with -source:3.7 settings. The new warning highlights code where this migration risk exists."
Scala 3.8 introduces betterFors, a feature that modifies how for-comprehensions are desugared, particularly affecting consecutive val bindings. The change removes a synthetic tuple-producing map that previously caused type conversions from Map to Iterable types like List. This results in different runtime behavior: code that produced List((43,29), (43,30), (43,31)) in Scala 3.7 now produces Map(43 -> 31) in 3.8. A new compiler warning alerts developers to potential migration risks. The previous behavior can be restored by explicitly converting Maps to Iterable types or using -source:3.7 compilation settings. Additional updates include REPL dependency support, Scala.js 1.20.2 upgrade, and Scala CLI version bump to 1.12.2.
Read at www.scala-lang.org
Unable to calculate read time
Collection
[
|
...
]