Scala 3.0.1-RC1 – further stabilising the compiler

Hello! We are happy to announce Scala 3.0.1-RC1 – the first release candidate in the post-3.0.0 era. With this release, we continue the work on making the compiler even more stable.

Experimental language features policy

Research and experimentation has always been an integral part of the Scala community's culture. That's what made Scala the language it is right now. Like many things in engineering, however, it's a part of a trade-off between experimentation and stability. Experimenting is fun and insightful, but when stakes on your project are high, stability becomes a priority.

Therefore, to ensure wide adoption of the language and its reliability in wide range of applications, we need to balance the two. We would like to have the room for trying new things out – but while doing so, we would like to keep in mind an ordinary Scala user who may not necessarily be interested in the bleeding edge and who would like their Scala dependencies and code to simply work. In the post-3.0.0 era, we must prioritize stability.

With this release, we are introducing a restriction on features marked as experimental. Now, it is not possible to use them from stable or RC releases. If you would like to experiment with them, you need to use a NIGHTLY version of the compiler. Nightlies are published every 24 hours, and you can find them on Maven.

The spirit of this policy is to make sure that effectively, no library published for Scala 3 contain experimental features. This way, what is experimental can be easily changed and is not subject to the guarantees of the wider language. And, most importantly, the changes to such features would not affect the community in practice – the guarantee not achievable if we just announced the policy without implementing a mechanism to enforce it.

Having said that, we still encourage people to play with the experimental features from the NIGHTLY compiler versions and discuss their findings. Without the curious and adventurous part of the community playing with the new features, there is no way of knowing what they are good for, and no way to decide whether they should be dropped or promoted to a stable feature.

More about this change you can read in the PR #12102.

Kind-projector work

This release also brings extra features for the Kind Projector migration support. First, PR #12378 allows _ as type lambda placeholder. Second, PR #12341 brings support for the variance annotations on the placeholder. This work enhances the ability to cross-compile Scala 2 code that uses the Kind Projector plugin to Scala 3.

Improved error reporting

Down the error reporting lane, match type reduction errors were improved. When using a match type, it may or may not reduce to one of its cases. If it doesn't match type is used as specified, e.g. if M[T] is a match type and it didn't reduce for M[Int], M[Int] will be used. This behavior, however, is frequently not what you want: there is a lot of cases where you would expect a match type to reduce but it doesn't. In such cases, it would be nice to have some diagnostic regarding why it didn't reduce. PR #12053 adds just such a diagnostic. E.g. the following code:

trait A
trait B
type M[X] = X match
  case A => Int
  case B => String
val x: String = ??? : M[B] // error

will report the following error:

6 |val x: String = ??? : M[B] // error
  |                ^^^^^^^^^^
  |                Found:    M[B]
  |                Required: String
  |
  |                Note: a match type could not be fully reduced:
  |
  |                  trying to reduce  M[B]
  |                  failed since selector  B
  |                  does not match  case A => Int
  |                  and cannot be shown to be disjoint from it either.
  |                  Therefore, reduction cannot advance to the remaining case
  |
  |                    case B => String

Scaladoc

We have updated the documentation for Scaladoc making it easier for you to get started. Also, PR #11582 has added the snippet compiler to ensure the snippets in your scaladoc documentation comments aren't broken. You can read more about this feature on the mailing list.

Metaprogramming

A lot of metaprogramming work was focused on improving the performance. Some of the notable PRs include:

  • Cache quote unpickling #12242
  • Avoid pickled tasty for some captured quote reference #12248
  • Improve quote matcher performance #12418
  • Port scala.quoted.runtime.impl.QuoteMatcher #12402

Issue fixing

Otherwise, we are making an effort to reduce our issue tracker. Among others, the following are some of the PRs dedicated to issue fixing:

  • IArray.toArray: Deprecate broken method #12598
  • Fix comparison of dependent function types #12214
  • Make translucentSuperType handle match types #12153
  • Harden Type Inference #12560
  • Reject references to self in super constructor calls #12567
  • Provide mirror support after inlining #12062
  • Allow export paths to see imports #12134
  • Streamline given syntax #12107
  • Export constructor proxies #12311
  • Identify package and nested package object in isSubPrefix #12297
  • Treat Refinements more like AndTypes #12317
  • Fix #9871: use toNestedPairs in provablyDisjoint #10560

Contributors

Thank you to all the contributors who made this release possible 🎉

According to git shortlog -sn --no-merges 3.0.0-RC2..3.0.1-RC1† these are:

   121  Martin Odersky
   111  Liu Fengyun
    98  Nicolas Stucki
    29  Guillaume Martres
    24  Phil
    20  Olivier Blanvillain
    14  Tom Grigg
    14  Adrien Piquerez
    13  Natsu Kagami
    12  Andrzej Ratajczak
    10  odersky
    10  Aleksander Boruch-Gruszecki
     9  Anatolii Kmetiuk
     8  Jamie Thompson
     6  Maxime Kjaer
     5  Som Snytt
     3  Filip Zybała
     3  Krzysztof Romanowski
     3  Kai
     3  Fengyun Liu
     3  noti0na1
     3  Phil Walker
     2  Johannes Rudolph
     2  soronpo
     2  tanishiking
     2  Adam Warski
     2  Kacper Korban
     2  Raphael Jolly
     2  Sébastien Doeraene
     1  xuwei-k
     1  Alexander Ioffe
     1  David Barri
     1  Devon Stewart
     1  Dmitrii Naumenko
     1  Ivan Kurchenko
     1  Jakub Kozłowski
     1  Jonas Ackermann
     1  Kevin Lee
     1  Martin
     1  Michał Pałka
     1  Miles Sabin
     1  Oron Port
     1  Paweł Marks
     1  Ruslan Shevchenko
     1  Seth Tisue
     1  Vadim Chelyshov
     1  nogurenn
     1  nurekata

†: Note that we measure against 3.0.0-RC2 and not 3.0.0 because we stabilized on 3.0.0-RC2. Only critical bug fixes found their way into 3.0.0-RC3 and further, while the majority of changes ended up in 3.0.1-RC1.

Library authors: Join our community build

Scala 3 now has a set of widely-used community libraries that are built against every nightly Scala 3 snapshot. Join our community build to make sure that our regression suite includes your library.