Scala Versions Save

Scala 2 compiler and standard library. Bugs at https://github.com/scala/bug; Scala 3 at https://github.com/scala/scala3

v2.13.2

4 years ago

Scala 2.13.2 has:

  • a brand-new Vector implementation
  • configurable warnings
  • an improved REPL (now JLine 3 based)
  • bugfixes and more

Vector

  • Rewrite Vector (using "radix-balanced finger tree vectors"), for performance (#8534)

Small vectors are now more compactly represented. Some operations are now drastically faster on large vectors. A few operations may be a little slower.

Kudos to @szeiger for this work.

Configurable warnings

  • Add -Wconf flag for configurable warnings, @nowarn annotation for local suppression (#8373)

Note that scala-collection-compat 2.1.6 (or newer) provides @nowarn for cross-built projects (as a no-op on 2.11 and 2.12).

Special thanks to Roman Janusz (@ghik), whose silencer plugin was the basis for this work.

REPL improvements

  • REPL: upgrade to JLine 3 (benefits include multi-line editing) (#8036)
  • Default true -Yrepl-class-based and -Yuse-magic-imports (#8748)
    • -Yrepl-class-based avoids deadlocks
    • -Yuse-magic-imports improves performance for long sessions
  • Improve REPL display of method types (#8319)

Special thanks to @som-snytt for spearheading the JLine 3 upgrade.

We are tracking JLine-related improvements and regressions here. There some known regressions in some less-vital features and behaviors; we plan to address these in future 2.13.x releases.

Language changes

  • Unicode escapes are now ordinary escape sequences (not processed early) (#8282)

Compiler fixes

  • Plug many variance holes (in higher-kinded types, refined types, and private inner classes) (#8545)
  • Fix variance handling for parameterized type aliases (#8651)
  • Exclude universal members (getClass, toString, etc) from root module import (#8541)
  • Matching strings makes switches in bytecode (#8451)

Deprecations

  • Deprecate eta-expansion, via trailing underscore, of methods with no argument lists (#8836)
  • Deprecate nested class shadowing in "override" position (#8705)
  • Deprecate numeric conversions that lose precision (e.g., Long to Double) (#8679)
  • Deprecate numeric widening of numeric literals which are not representable with Float/Double (#8757)
  • Deprecate old-style constructor syntax (#8591)

Improvements from the future

  • There is no more -Xsource:2.14, only -Xsource:3 (#8812)
  • Allow infix operators at start of line (under -Xsource:3) (#8419)
  • Case class copy and apply inherit access modifiers from constructor (under -Xsource:3) (#7702)

Other fixes and improvements

  • Un-deprecate default floating point Orderings; issue migration warning instead under -Xmigration (#8721)
  • Support macro annotation expansions in -Wmacros:MODE (#8799)
  • Scaladoc can now link to Javadoc for the Java standard library for JDK versions 9 and up (overridable with new -jdk-api-doc-base flag) (#8663)
  • sys.env now throws on null environment variable (#8579)
  • Make the hashcode method ## have no parameter list (instead of a single empty one) (#8814)

This is not a complete list of changes. For that, see all merged PRs and all closed bugs.

2.13.2 also includes the changes in Scala 2.12.11, most notably:

  • Make optimizer work on JDK 13+ (#8676).

Compatibility

As usual for our minor releases, Scala 2.13.2 is binary-compatible with the whole Scala 2.13 series.

Upgrading from 2.12? Enable -Xmigration while upgrading to request migration advice from the compiler.

Contributors

A big thank you to everyone who's helped improve Scala by reporting bugs, improving our documentation, spreading kindness in discussions around Scala, and submitting and reviewing pull requests! You are all magnificent.

This release was brought to you by 45 contributors, according to git shortlog -sn --no-merges HEAD ^v2.13.1 ^2.12.x. Thank you Som Snytt, Jason Zaugg, Lukas Rytz, Dale Wijnand, Seth Tisue, Diego E. Alonso Blas, Georgi Krastev, Martijn Hoekstra, Eugene Yokota, Harrison Houghton, Stefan Zeiger, NthPortal, Anatolii, Linas Medžiūnas, Aaron S. Hawley, Guillaume Martres, Josh Lemer, Sébastien Doeraene, Jasper Moeys, Julien Truffaut, Oskar Haarklou Veileborg, Lucas Cardoso, Andrew Valencik, Adriaan Moors, yudedako, Steven Barnes, Brian Wignall, Ausmarton Zarino Fernandes, Oguz Albayrak, Philippus, Viktor Klang, Yang Bo, bnyu, psilospore, sinanspd, wholock, Jamie Thompson, Hamza Meknassi, Janek Bogucki, Flash Sheridan, Fabian Page, Kenji Yoshida, Denis Rosset, Lucas S Cardoso, Chris Birchall.

Thanks to Lightbend for their continued sponsorship of the Scala core team’s efforts. Lightbend offers commercial support for Scala.

Scala 2.13 notes

The release notes for Scala 2.13.0 have important information applicable to the whole 2.13 series.

Obtaining Scala

Scala releases are available through a variety of channels, including (but not limited to):

v2.12.11

4 years ago

The Scala 2.12.11 release mainly brings bug fixes and performance improvements.

Highlights

  • Performance improvements in the collections library: algorithmic improvements and changes to avoid unnecessary allocations (list of PRs)
  • Performance improvements in the compiler (list of PRs, minor effects in our benchmarks)
  • Improvements to -Yrepl-class-based, an alternative internal REPL encoding that avoids deadlocks (details on #8712)
  • A new -Yrepl-use-magic-imports flag that avoids deep class nesting in the REPL, which can lead to deteriorating performance in long sessions (#8576)
  • Fix some toX methods that could expose the underlying mutability of a ListBuffer-generated collection (#8674)

JDK 9+ support

  • ASM was upgraded to 7.3.1, allowing the optimizer to run on JDK 13+ (#8676)
  • :javap in the REPL now works on JDK 9+ (#8400)

Other changes

  • Support new labels for creating durations for consistency: Duration("1m"), Duration("3 hrs") (#8325, #8450)
  • Fix memory leak in runtime reflection's TypeTag caches (#8470) and some thread safety issues in runtime reflection (#8433)
  • When using compiler plugins, the ordering of compiler phases may change due to #8427

For more details, see the full list of merged PRs and the list of closed bugs.

Compatibility

Custom subclasses of immutable.HashSet and immutable.HashMap that override elemHashCode are no longer supported. Note that HashSet and HashMap are sealed, and their subclasses in the standard library are marked @deprecatedInheritance. More details in scala-dev#675.

As usual for our minor releases, Scala 2.12.11 is binary compatible with the whole Scala 2.12 series.

Contributors

A big thank you to everyone who's helped improve Scala by reporting bugs, improving our documentation, spreading kindness in discussions around Scala, and submitting and reviewing pull requests! You are all magnificent.

This release was brought to you by 15 contributors, according to git shortlog -sn --no-merges v2.12.10..v2.12.11. Thank you Jason Zaugg, Mike Skells, Harrison Houghton, Dale Wijnand, Seth Tisue, Lukas Rytz, A. P. Marki, Laurynas Lubys, Diego E. Alonso Blas, Daniele Torelli, Philippus, Aaron S. Hawley, leitoh, Eugene Yokota.

Thanks to Lightbend for their continued sponsorship of the Scala core team's efforts. Lightbend offers commercial support for Scala.

Scala 2.12 notes

The release notes for Scala 2.12.0 have important information applicable to the whole 2.12 series.

Obtaining Scala

Scala releases are available through a variety of channels, including (but not limited to):

v2.13.1

4 years ago

Scala 2.13.1 is primarily a bug fix release that fixes several regressions in 2.13.0.

  • Revert Stream.Cons to the 2.12 encoding (#8354)
  • Don't rebuild scala.Seq to drop elems in unapplySeq (#8340)
  • Blacken subtrees where necessary in RedBlackTree.take (#8287)
  • Iterator#flatMap#hasNext calls outer#hasNext 1 time, not 2-3 times (#8220)
  • s.c.Map#values returns a strict Iterable rather than a View (#8195)
  • Vector.from(ArraySeq) copies elems rather than reusing unsafeArray (#8194)
  • Fix mutable.HashSet.addAll: remove redundant call to super method (#8192)
  • Fix mutable.ArraySeq.ofChar#addString (#8176)
  • Fix HashMap#mapValuesInPlace (#8421)

Other regressions

  • Avoid spurious "illegal cyclic reference" errors (#8382)
  • Stabilize args of apply (#8202)
  • Reject incomplete implicit dictionaries (#8201)
  • Process exit code on script errors (#8169)
  • Fix type inference involving wildcards (#8129)

Other bug fixes and improvements

  • Extend the Gradle / sbt 0.13 leniency to Windows (#8408)
  • Avoid unnecessary toSeq conversions in Seq methods (#8374)
  • Avoid memory leaks in Stream methods (#8367)
  • Precompile -i files for script runner (#8349)
  • Stop warning on higher-kinded usage without -language:higherKinds (#8348)
  • Simplify reporters (#8338)
  • More efficient ArraySeq iteration (#8300)
  • Enable hyperlinking to Java docs (#8284)
  • Parent implicitNotFound message is supplemental (#8280)
  • Add protected and private visibility filters to scaladoc (#8183)
  • Fix vulnerability in jQuery used in ScalaDoc (#8179)
  • Synthesize a PartialFunction from function literal (#8172)
  • Fix parsing of try (#8071)
  • Support emitting Java 9 bytecode by adding "-target:9" (#8060)
  • Deprecate mutable.MultiMap (#8005)
  • Add syntactic sugar for if(_) (#7707)
  • A foreign definition induces ambiguity (#7609)

This is not a complete list of changes. For that, see all merged PRs and all closed bugs.

Compatibility

Upgrading from 2.12? Enable -Xmigration while upgrading to request migration advice from the compiler.

As usual for our minor releases, Scala 2.13.1 is binary-compatible with the whole Scala 2.13 series.

Contributors

A big thank you to everyone who's helped improve Scala by reporting bugs, improving our documentation, spreading kindness in discussions around Scala, and submitting and reviewing pull requests! You are all magnificent.

This release was brought to you by 43 contributors, according to git shortlog -sn --no-merges HEAD ^v2.13.0 ^upstream/2.12.x. Thank you Som Snytt, Lukas Rytz, Aaron S. Hawley, exoego, Jason Zaugg, Dale Wijnand, Seth Tisue, Stefan Zeiger, NthPortal, Martijn Hoekstra, Jasper Moeys, Josh Lemer, Isaac Levy, Harrison Houghton, Benjamin Kurczyk, redscarf, 杨博 (Yang Bo), Adriaan Moors, Anatolii Kmetiuk, Eugene Yokota, Georgi Krastev, Miles Sabin, Philippus, xuwei-k, Magnolia.K, Mike Skells, 2efPer, Mitesh Aghera, NomadBlacky, Guillaume Martres, Odd Möller, yui-knk, Georg, Flash Sheridan, Diego E. Alonso Blas, Sébastien Doeraene, Atsushi Araki, psilospore, Akhtyam Sakaev, wanying.chan, Li Haoyi, M.Shibuya, Kota Mizushima.

Thanks to Lightbend for their continued sponsorship of the Scala core team’s efforts. Lightbend offers commercial support for Scala.

Scala 2.13 notes

The release notes for Scala 2.13.0 have important information applicable to the whole 2.13 series.

Obtaining Scala

Scala releases are available through a variety of channels, including (but not limited to):

v2.12.10

4 years ago

Highlights

The main purpose of this release is to fix the following regressions in 2.12.9:

  • Fix regression in large string interpolations with non-String typed splices (#8315)
  • Revert "Generate shallower ASTs in pattern translation" (#8327, reverting #8061)
  • Fix regression in classpath when JARs have 'a.b' entries beside 'a/b' (#8321)

Further highlights

  • Improvements to thread-safety of runtime reflection (#8396)
  • Add some customization to JAR writing (#8268)
  • Minor improvements to compiler performance

This is not a complete list of changes. For that, see all merged PRs and all closed bugs.

Compatibility

As usual for our minor releases, Scala 2.12.10 is binary-compatible with the whole Scala 2.12 series.

Contributors

A big thank you to everyone who's helped improve Scala by reporting bugs, improving our documentation, spreading kindness in discussions around Scala, and submitting and reviewing pull requests! You are all magnificent.

This release was brought to you by 7 contributors, according to git shortlog -sn --no-merges v2.12.9..v2.12.10. Thank you Jason Zaugg, Diego E. Alonso Blas, Aaron S. Hawley, Mike Skells, Seth Tisue, Eugene Yokota, exoego.

Thanks to Lightbend for their continued sponsorship of the Scala core team’s efforts. Lightbend offers commercial support for Scala.

Scala 2.12 notes

The release notes for Scala 2.12.0 have important information applicable to the whole 2.12 series.

Obtaining Scala

Scala releases are available through a variety of channels, including (but not limited to):

v2.12.9

4 years ago

Highlights

  • Faster compiler: 5–10% faster since 2.12.8, thanks to many optimizations (mostly by Jason Zaugg and Diego E. Alonso-Blas: kudos!)
  • Improved compatibility with JDK 11, 12, and 13 (see below)
  • Experimental support for build pipelining and outline type checking (see below)

Compatibility

As usual for our minor releases, Scala 2.12.9 is binary compatible with the whole Scala 2.12 series.

Scala.js users must update to 0.6.28+ or 1.0.0-M8+ to use Scala 2.12.9. (#7375)

Compatibility with JDK 11, 12, and 13

Scala 2.12.9 contains various fixes to improve compatibility with JDK 11, 12, and 13.

  • Backport upgrade to ASM 7 for JDK 12 compatibility (#7780)
  • Fix -release N flag on JDK 12+ (#7763)
  • Fix "cannot be represented as URI" on JDK 13 (#8210)
  • Add JDK 9 constant types to the ClassfileParser to fix Scaladoc generation issue (#8289)

Build pipelining and outline type checking

Scala 2.12.9 adds experimental infrastructure intended to support "build pipelining". Once build tools add support, compilation of downstream subprojects could begin once upstream code has been type-checked. See scala-dev#643.

Further highlights

  • Fix large string interpolation causing compile-time StackOverflowError (#7995, #7996)
  • Un-deprecate eta-expansion of 0-ary methods (#7740)
  • Fix Java signature for value classes appearing in type arguments (#8127)
  • Backport fix for interop between Java and generic inner Scala classes (#7977)
  • Make the inferred packedTypes deterministic in bytecode (#7751)
  • Add -doc-canonical-base-url to set a canonical URL in Scaladoc (#7998)
  • Backport fix for "illegal cyclic reference involving class" (#8161)
  • Cache materialized TypeTags (#8112)
  • Reduce the overhead of macro expansion (#8088)

For more details, check out all closed bugs and merged PRs.

Contributors

A big thank you to everyone who's helped improve Scala by reporting bugs, improving our documentation, spreading kindness in discussions around Scala, and submitting and reviewing pull requests! You are all magnificent.

This release was brought to you by 24 contributors, according to git shortlog -sn --no-merges v2.12.8..v2.12.9. Thank you Jason Zaugg, Diego E. Alonso-Blas, Seth Tisue, Harrison Houghton, Adriaan Moors, Lukas Rytz, Aaron S. Hawley, Eugene Yokota, Michael Pollmeier, ta.tanaka, Enno Runne, A. P. Marki, Georgi Krastev, Kenji Yoshida, Stefan Zeiger, exoego, Benjamin Kurczyk, Anselm von Wangenheim, Alex Vayda, Sunil Mishra, Sébastien Doeraene, tgodzik, Dale Wijnand, Ryo Fukumuro.

Thanks to Lightbend for their continued sponsorship of the Scala core team’s efforts. Lightbend offers commercial support for Scala.

Scala 2.12 notes

The release notes for Scala 2.12.0 have important information applicable to the whole 2.12 series.

Obtaining Scala

Scala releases are available through a variety of channels, including (but not limited to):

v2.13.0

4 years ago

We are delighted to announce the availability of Scala 2.13.0!

Release summary

2.13 improves Scala in the following areas:

  • Collections: Standard library collections have been overhauled for simplicity, performance, and safety. This is the centerpiece of the release.
  • Standard library: Future is faster and more robust. Elsewhere, useful classes and methods have been added.
  • Language: Literal types, partial unification, by-name implicits, more.
  • Compiler: 5-10% faster, deterministic output, improved optimizer.

To learn more, read on.

Collections redesign

Standard library collections have been overhauled for simplicity, performance, and safety.

This is the centerpiece of the release.

Most ordinary code that used the old collections will continue to work as-is, except as detailed below.

The most important collections changes are:

  • Simpler method signatures
    • No more CanBuildFrom. Transformation methods no longer take an implicit CanBuildFrom parameter.
    • The resulting library is easier to understand (in code, Scaladoc, and IDE code completion).
    • It also makes user code compile faster.
    • A new BuildFrom implicit is used in a handful of places that need it.
  • Simpler type hierarchy
    • No more Traversable and TraversableOnce.
      • They remain only as deprecated aliases for Iterable and IterableOnce.
    • Parallel collections are now a separate module.
      • As a result, GenSeq, GenTraversableOnce, et al are gone.
  • Immutable scala.Seq
    • Seq is now an alias for collection.immutable.Seq
      • Before, it was an alias for the possibly-mutable collection.Seq.
    • This also changes the type of varargs in methods and pattern matches.
    • Arrays passed as varargs are defensively copied. (#6970)
  • Simplified views that work
    • collection.Views have been vastly simplified and should now work reliably.
  • Alphanumeric method names
    • All symbolic operators are now just aliases for descriptive alphanumeric method names.
    • Examples: ++ (alias for concat), +: (alias for prepended), :+ (alias for appended), and so on.
  • New, faster HashMap/Set implementations
    • Both immutable (d5ae93e) and mutable (#7348) versions were completely replaced.
    • They substantially outperform the old implementations in most scenarios.
    • The mutable versions now perform on par with the Java standard library's implementations.
  • New concrete collections
  • New abstract collection type SeqMap

Additional collections changes:

  • New to(Collection) method
    • Replaces old to[Collection] method.
    • The argument is the companion object of the desired collection type, for example .to(Vector).
    • The API change enables support for all collection types (including Map, BitSet, et al).
  • No more collection.breakOut
    • It required CanBuildFrom, which no longer exists.
    • To avoid constructing intermediate collections, use .view and .to(Collection) instead.
  • List and Vector are safer
    • They now offer safe publication under the Java Memory Model, using releaseFence (#6425)
  • Added in-place operations on mutable collections
    • filterInPlace, mapInPlace, flatMapInPlace, and others.
    • These methods update the original collection in-place, rather than creating a new collection to hold the results.
  • Java interop has moved
    • Extension methods for Scala are now in scala.jdk
    • Explicit converters for Java are in scala.jdk.javaapi
    • The reorganization centralizes all to-and-from-Java converters, including both collection and non-collection types, in a single package.
    • Added Stepper, which is like Iterator but supports efficient unboxed iteration, Java interop. (#7458)
  • Collection serialization has changed
    • Collections now use the serialization proxy pattern uniformly whenever possible. (#6676, #7624, scala-dev#562, sbt/sbt#89)
    • In some classloading environments, notably sbt's non-forked test execution, code changes may be needed.
  • Added .unfold
    • This allows constructing a collection or iterator from an initial element and a repeated Option-returning operation, terminating on None.
    • This was added collection companion objects and to Iterator (#6851)
  • Added .lengthIs/.sizeIs and .sizeCompare
    • These allow fluent size comparisons without traversing the whole collection (#6950, #6758)
    • Examples: xs.sizeIs < 10, xs.sizeIs == 2
  • Error-prone Map methods deprecated
    • Deprecated .filterKeys and .mapValues (#7014)
    • Instead, use the new methods of the same names on MapView (e.g. .view.filterKeys)
  • Added .lazyZip
  • Added .tapEach method
    • This allows inserting side-effects in a chain of method calls on a collection or view. (#7124)
  • Added .updatedWith and updateWith methods to Maps
    • updatedWith is on immutable.Map, updateWith is on mutable.Map. (#7320, #7517)
    • These methods allow modifying a map entry based on its current value.
  • Added .maxOption, .minOption, .maxByOption, .minByOption
    • These methods safely handle the empty case. (#6574)
  • Deprecated symbolic methods with multiple arguments
    • Such methods may be disallowed entirely in a future Scala. (#6719)
  • Adding custom collections and operations works very differently
    • See documentation links below.

To learn more about the new APIs and how to adapt your code, consult:

We welcome assistance in continuing to expand and improve these documents.

Concurrency

Futures were internally redesigned, with these goals:

  • provide expected behavior under a broader set of failure conditions
  • provide a foundation for increased performance
  • support more robust applications

Details:

  • Updated and revised our Future and Promise implementation. (#6610, #7663)
    • Among other changes, handling of InterruptedException and RejectedExecutionException is improved.
  • Made the global ExecutionContext “batched”. (#7470)
    • (This change was reverted in Scala 2.13.4. The batched executor is available for opt-in, but will no longer be the default. See the 2.13.4 release notes.)
  • Added synchronous ("parasitic") ExecutionContext. (#7784)

Standard library: additions

  • Integrated Java interop (#7987)
    • The old scala-java8-compat module is now part of the standard library. (#7458)
    • This provides converters for options, function types and Java streams.
    • (As mentioned above, collection converters such as JavaConverters were moved to fit into the new scheme.)
  • new: scala.util.Using
    • This uses the loan pattern to provide a simple form of automatic resource management. (#6907, #7468)
  • new: use s interpolator in pattern matches
    • Provides a simple string matcher as the dual of the simple string interpolator. (#7387)
    • Example: val s"$day-$month-$year" = "11-June-2019"
  • new: pipe and tap
    • These chaining operations are available via import scala.util.chaining._. (#7007)
    • Example: 3.pipe(_ * 5) evaluates to 15
    • Example: 9.tap(println) first prints 9, then returns it
  • new: .toIntOption, et al
    • These new extension methods on String are provided by StringOps.
    • They parse literals and efficiently reject invalid input without throwing exceptions. (#6538)
    • Examples: "12".toIntOption => Some(12), "12.3".toIntOption => None, "12.3".toDoubleOption => Some(12.3)
  • new: named Product elements
  • new: .withRight, .withLeft
    • These methods on Left and Right allow upcasting the other type parameter (#7011, #7080)
    • Example: Left(3).withRight[String] has type Either[Int, String] without having to write Int
  • new: Ordering.Double.TotalOrdering, Ordering.Float.TotalOrdering
  • new: converters between functions and extractors
    • New methods provide conversions among optional Functions, PartialFunctions and extractor objects. (#7111)
  • new: @unused annotation
    • This annotation is useful for suppressing warnings under -Xlint. (#7623)

Standard library: changes

  • Library fits in compact1 profile
  • Option extends IterableOnce
    • This improves type inference when calling an overloaded flatMap. (#8038)
  • Undeprecate linesIterator to avoid conflict with JDK 11's String.lines (#7269)
  • PartialFunction now overloads andThen. (#7263)
  • Replaced Cloneable/Serializable traits with type aliases (#6729)
  • ControlThrowable never suppresses (#7413)
  • BigDecimal's handling of MathContexts has changed (#6884)

Standard library: deprecations and removals

Not a complete list, only the deprecations users are likeliest to encounter.

  • String-building using + with a non-String type on the left (aka any2stringadd) is deprecated. (#6315, #6755)
  • PartialFunction.fromFunction replaces PartialFunction.apply (#6703)
  • Right projections on Either are deprecated. (#6682, #8012)
  • Deprecated @usecase Scaladoc tag. (#7462)
  • Deprecated universal Equiv. (#7414)
  • The following modules are no longer included in the distribution: scala-xml, scala-parser-combinators, scala-swing.
    • They are community-maintained and published to Maven Central.
  • Assorted deprecated methods and classes throughout the standard library have been removed entirely.

Language changes

2.13 is primarily a library release, not a language/compiler release. Regardless, some language changes are included:

Features:

  • Literal types
    • Literals (for strings, integers, and so on) now have associated literal types. (#5310)
    • See the original proposal, SIP-23, for motivation and details.
    • The compiler will provide instances of a new typeclass scala.ValueOf[T] for all singleton types T.
    • A Singleton upper bound prevents widening (e.g. T <: Int with Singleton).
    • The value of a singleton type can be accessed by calling method valueOf[T]. Example: val one: 1 = valueOf[1]
  • Partial unification on by default
  • By-name implicits with recursive dictionaries
    • This extends by-name method arguments to support implicit (not just explicit) parameters.
    • This enables implicit search to construct recursive values.
    • The flagship use-case is typeclass derivation.
    • Details: see the by-name implicits SIP, #6050, #7368
  • Underscores in numeric literals
    • Underscores can now be used as a spacer. (#6989)
    • Example: 1_000_000

Experimental features:

Deprecations:

  • Procedure syntax deprecated
    • Deprecated: def m() { ... } (#6325)
    • Use instead: def m(): Unit = { ... }
  • View bounds deprecated
    • Deprecated: A <% B (#6500)
    • Use instead: (implicit ev: A => B)
  • Symbol literals deprecated
    • Symbols themselves remain supported, only the single-quote syntax is deprecated. (#7395)
    • Library designers may wish to change their APIs to use String instead.
    • Deprecated: 'foo
    • Use instead: Symbol("foo")
  • Unicode arrows deprecated
    • In particular, the single arrow operators had the wrong precedence. (#7540)
    • Deprecated: , ,
    • Use instead: =>, ->, <-
  • postfixOps syntax disabled by default
    • The syntax, already deprecated in 2.12, causes an error in 2.13 unless the feature is explicitly enabled. (#6831)
    • Error: xs size
    • Use instead: xs.size

Adjustments:

  • Imports, including wildcard imports, now shadow locally defined identifiers. (#6589)
  • Underscore is no longer a legal identifier unless backquoted (bug#10384)
    • val _ = is now a pattern match (and discards the value without incurring a warning)
    • implicit val _ = is also now a pattern match (and is useless, because it no longer adds to implicit scope)
  • Don't assume unsound type for ident/literal patterns. (#6502)
    • Matches of the form case x@N involve calling equals, so it was unsound to type x as N.type.
    • Consider rewriting as case x:N.type.
  • Make extractor patterns null safe. (#6485)
    • null is treated as no match.
  • Better typing for overloaded higher-order methods (#6871, #7631)
    • This change was a key enabler for the new collections design.
  • Rework unification of Object and Any in Java/Scala interop (#7966)
  • Name-based pattern matching has changed to enable immutable Seq matches (#7068)
  • Automatic eta-expansion of zero-argument methods is no longer deprecated (#7660)
  • Improve binary stability of extension methods (#7896)
  • Macros must now have explicit return types (#6942)
  • Mixin fields with trait setters are no longer JVM final (#7028)
    • In addition, object fields are now static (#7270)
  • Support implicitNotFound on parameters (#6340)
  • Disallow repeated parameters except in method signatures (#7399)
  • Value-discard warnings can be suppressed via type ascription to Unit. (#7563)
  • x op () now parses as x.op(()) not x.op() (#7684)

Compiler

  • Deterministic, reproducible compilation
    • The compiler generates identical output for identical input in more cases, for reproducible builds. (scala-dev#405)
  • Optimizer improvements
    • Operations on collections and arrays are now optimized more, including improved inlining. (#7133)

And:

  • Scaladoc supports setting canonical URLs (#7834)
    • This helps search engines identify the most relevant/recent version of a page when several versions are available.
  • Compiler suggests possible corrections for unrecognized identifiers (#6711)
    • Example: List(1).sizzle => value sizzle is not a member of List[Int], did you mean size?
  • Added -Yimports for custom preamble imports. (#6764)
    • Example: -Yimports:x,y,z means x, y, and z are root imports of the form: import x._ { import y._ { import z._ { ... } } }
  • The scala-compiler JAR no longer depends on scala-xml (#6436)

Plus, changes to compiler options:

  • Partition options by function: -V for verbose, -W for warnings
    • In general, the old flags still exist as aliases. (#7908)
    • Exceptions (breaking changes) include:
      • Replaced -warn-option with -Woption.
      • Replaced -Xprint:all with -Vprint:_
    • -Werror is now recommended over -Xfatal-warnings.
  • Promoted -deprecation to -Xlint:deprecation (#7714)
  • Deprecated -Xfuture (#7328)
    • Instead, use e.g. -Xsource:2.14
  • Removed -Yno-adapted-args
  • Removed -Xmax-classfile-length
    • It's hard-coded to 240 now (#7497)

Scripting, environment, and integrations

  • The script runner (scala Script.scala) no longer uses the fsc compilation daemon by default. (#6747)
    • The daemon was not reliable and will likely be removed entirely from a future release.
  • JEP 293 style long command-line options are now supported (#6499)
  • The REPL has undergone an internal refactoring to enable future improvements. (#7384)
  • Ant support is no longer bundled. (#6255)

Compiler performance

We invested heavily in compiler speedups during the 2.13 cycle, but most of that work actually already landed in the 2.12.x series, with more to come in 2.12.9.

In addition, compiler performance in 2.13 is 5-10% better compared to 2.12, thanks mainly to the new collections. See performance graph.

Also, certain kinds of code now compile much faster because the compiler aggressively prunes polymorphic implicits during search (#6580).

Migration

Upgrading from 2.12? Enable -Xmigration while upgrading to request migration advice from the compiler.

Compatibility

Like Scala 2.12, the 2.13 series targets Java 8, minimum. Both 2.12 and 2.13 also work on later JDKs such as JDK 11; see our JDK Compatibility Guide.

Although Scala 2.11, 2.12, and 2.13 are mostly source compatible to facilitate cross-building, they are not binary compatible. This allows us to keep improving the Scala compiler and standard library.

All 2.13.x releases will be fully binary compatible with 2.13.0, in according with the policy we have followed since 2.10.

Projects built with sbt must use at least sbt 1.2.8 (or 0.13.18) to use Scala 2.13. To move to 2.13, bump the scalaVersion setting in your existing project.

Scala also works with Maven, Gradle, and other build tools.

Obtaining Scala

Scala releases are available through a variety of channels, including (but not limited to):

  • Bump the scalaVersion setting in your sbt-based project
  • Download a distribution from scala-lang.org
  • Obtain JARs via Maven Central
  • Certain package managers (such as homebrew and SDKMAN) offer Scala.

Reporting bugs

Please file any bugs you encounter on our issue tracker. If you aren't yet sure something is a bug, ask on users.scala-lang.org.

Contributors

A big thank you to everyone who's helped improve Scala by reporting bugs, improving our documentation, kindly helping others on forums and at meetups, and submitting and reviewing pull requests! You are all magnificent.

Scala 2.13.0 is the result of merging over 1500 pull requests.

The pull request queue is managed by the Scala team at Lightbend: Adriaan Moors, Lukas Rytz, Jason Zaugg, Seth Tisue, Stefan Zeiger, Eugene Yokota.

Thanks to Lightbend for their continued sponsorship of the Scala core team’s efforts. Lightbend offers commercial support for Scala.

The new collections API was developed in fruitful collaboration with the Scala Center, with major contributions from the community.

This release was brought to you by 162 contributors, according to git shortlog -sn --no-merges 2.13.x ^2.12.x ^e2a211c. Thank you Julien Richard-Foy, Lukas Rytz, Jason Zaugg, A. P. Marki, Stefan Zeiger, Kenji Yoshida, Adriaan Moors, Josh Lemer, NthPortal, Miles Sabin, Diego E. Alonso-Blas, Seth Tisue, Guillaume Martres, Marcelo Cenerino, Dale Wijnand, Odd Möller, Martin Odersky, Allan Renucci, Georgi Krastev, Eugene Yokota, Harrison Houghton, Martijn Hoekstra, Viktor Klang, Aaron S. Hawley, Ólafur Páll Geirsson, Rex Kerr, hepin1989, Philippus Baalman, Matthew de Detrich, Isaac Levy, exoego, Greg Methvin, Jasper Moeys, Sébastien Doeraene, wholock, Aggelos Biboudis, yui-knk, Matthias Sperl, Xavier Fernández Salas, Ethan Pronovost, Janek Bogucki, awibisono, BuildTools, Mike Skells, Jimin Hsieh, Jonathan Frawley, Xavier GUIHOT, Chris Phelps, chanyong.moon, Cong Zhao, Enno Runne, LPTK, Pathikrit Bhowmick, Yuval Dagan, Li Haoyi, Guillaume Massé, Christopher Hunt, Kamil Kloch, Marco Zühlke, Danila Matveev, Juliusz Sompolski,杨博 (Yang Bo), Masaru Nomura, Benjamin Kurczyk, Vince, taku0, Arnout Engelen, Tim Ruhland, Nicolas Stucki, Nicolas Rinaudo, Stephen Nancekivell, ashwin, Kobenko Mikhail, Song Kun, Anthony Tjuatja, k.bigwheel, ke-to, kelebra, mcintdan, mmocentre, psilospore, roman, svatsan, texasbruce, tim-zh, valydia, veera venky,虎鸣, Adianto Wibisono, Alden Torres, Alejandro Sellero, Alessandro Buggin, Alex Glukhovtsev, Alex Levenson, Alexey-NM, Anatolii, Andrei Baidarov, Andriy Plokhotnyuk, Bakhytzhan Karabalin, Benni, Callum Turnbull, Chris Birchall, Chujie Zeng, Cody Allen, Daniel Dietrich, Daniel Moss, Daniel Slapman, David Barri, David Hoepelman, Denis Buzdalov, Denys Shabalin, Dhanesh, Dhanesh Arole, Edin Dudojević, Eugene Platonov, Faiz Halde, Gabriel Claramunt, Heikki Vesalainen, Iaroslav Zeigerman, Jack Koenig, Jean Michel Rouly, Jeff Brower, Jeff Shaw, Josh, Kazuhiro Sera, Kentaro Tokutomi, Lionel Parreaux, Magnolia.K, Martin Duhem, Michael Steindorfer, Nafer Sanabria, Narek Asadorian, Oleksii Tkachuk, Oscar Boykin, PJ Fanning, Paolo Giarrusso, Pap Lőrinc, Pavel Petlinsky, Peter Fraenkel, Philip, Piotr Kukielka, Qiang Sima, Rob Norris, Robin Stephenson, Rui Gonçalves, Ruud Welling, Ryan McDougall, ShankarShastri, Simão Martins, Sperl Matthias, Sujeet Kausallya Gholap, Uttej Guduru, Vincent de Haan, Vladimir Parfinenko, Vlastimil Dort, Yang Bo, Zizheng Tai, ccjoywang, esarbe, howtonotwin, jvican.

Conclusion

We again thank our contributors and the entire Scala community.

May you find Scala 2.13 a joy to code in!

v2.13.0-RC3

4 years ago

Scala 2.13 is almost here! We present the third 2.13 release candidate. The changes since RC2 are minor.

We hope library maintainers will test and publish their libraries for RC3, to validate the release candidate and enable 2.13.0 to go forward.

About these notes

These are the detailed technical release notes for RC3 only, documenting changes since RC2 only.

We don't yet have a combined, friendlier release note covering 2.13 as a whole yet. That will follow in time for 2.13.0. For now, see also the notes for RC2, RC1, M5, M4, M3, M2, and M1.

Binary compatibility

As usual for Scala pre-releases, RC3 is not binary compatible with any other Scala version, including previous 2.13 milestones and release candidates.

We will not break binary compatibility between RC3 and 2.13.0 unless really necessary.

Libraries for RC3

As libraries are published for RC3, they're added to https://github.com/scala/make-release-notes/blob/2.13.x/projects-2.13.md .

Changes in RC3

We merged 16 pull requests for RC3. The highlights are:

  • Remove unnecessary type parameter on IterableOnce#stepper (#8083)
  • Add default IterableOnce#knownSize impl (#8093)
  • Un-deprecate option2Iterable implicit conversion (#8106)

For further changes, see merged PRs and closed bugs.

See also the notes for the previous release candidates and milestones: RC2, RC1, M5, M4, M3, M2, M1.

Compiler performance in 2.13 is 5-10% better than 2.12. The integration of the new collections library shows up in the performance graph as a nice improvement.

Collections changes

To learn about the collections changes since 2.12 and how to adapt your code, take a look at these documents:

These documents are still being expanded and improved.

Contributors

A big thank you to everyone who's helped improve Scala by reporting bugs, improving our documentation, spreading kindness in discussions around Scala, and submitting and reviewing pull requests! You are all magnificent.

This release was brought to you by 10 contributors, according to git shortlog -sn --no-merges v2.13.0-RC2..v2.13.0-RC3. Thank you Lukas Rytz, NthPortal, Josh Lemer, Philippus Baalman, Stefan Zeiger, Aaron S. Hawley, mcintdan, Adriaan Moors, Anatolii, Eugene Yokota.

Thanks to Lightbend for their continued sponsorship of the Scala core team’s efforts. Lightbend offers commercial support for Scala.

Obtaining Scala

Scala releases are available through a variety of channels, including (but not limited to):

v2.13.0-RC2

5 years ago

Scala 2.13 is almost here! We are delighted to present the second 2.13 release candidate.

Since RC1, we and our crew of community contributors have been fixing bugs and improving Java interop.

We ask all library maintainers to test and publish their libraries for RC2 as soon as possible. This is crucial to validate the release candidate and enable 2.13.0 to go forward.

About these notes

These are the detailed technical release notes for RC2 only, documenting changes since RC1 only.

We don't yet have a combined, friendlier release note covering 2.13 as a whole yet. That will follow in time for 2.13.0. For now, see also the notes for RC1, M5, M4, M3, M2, and M1.

Binary compatibility

As usual for Scala pre-releases, RC2 is not binary compatible with any other Scala version, including previous 2.13 milestones and release candidates.

We will not break binary compatibility between RC2 and 2.13.0 unless really necessary.

Libraries for Scala 2.13.0-RC2

As libraries are published for RC2, they're added to https://github.com/scala/make-release-notes/blob/2.13.x/projects-2.13.md .

Collections changes

To learn about the collections changes since 2.12 and how to adapt your code, take a look at these documents:

These documents are still being expanded and improved.

RC2 changes

We merged 50 pull requests for RC2. The highlights are:

  • Emit mixin forwarders as ordinary, non-bridge methods again (#8037)
  • Rework unification of Object and Any in Java/Scala interop (#7966)
  • Make Option extend IterableOnce (#8038)
  • Organize JDK converters: extension methods for Scala in scala.jdk, explicit converters for Java in jdk.javaapi (#7987)
  • Un-deprecate left Either projections (#8012)
  • Scaladoc: support setting canonical URLs (#7834)

For further changes, see merged PRs and closed bugs.

See also the notes for the previous release candidates and milestones: RC1, M5, M4, M3, M2, M1.

Compiler performance in 2.13 is 5-10% better than 2.12. The integration of the new collections library shows up in the performance graph as a nice improvement.

Contributors

A big thank you to everyone who's helped improve Scala by reporting bugs, improving our documentation, spreading kindness in discussions around Scala, and submitting and reviewing pull requests! You are all magnificent.

This release was brought to you by 23 contributors, according to git shortlog -sn --no-merges v2.13.0-RC1..v2.13.0-RC2. Thank you Lukas Rytz, Jason Zaugg, Aaron S. Hawley, Seth Tisue, Adriaan Moors, Stefan Zeiger, NthPortal, Michael Pollmeier, Philippus, Guillaume Martres, Diego E. Alonso-Blas, Christopher Hunt, Kenji Yoshida, Nicolas Rinaudo, Sébastien Doeraene, Arnout Engelen, Dale Wijnand, Enno Runne, Georgi Krastev, Harrison Houghton, Josh Lemer, Odd Möller, Rex Kerr.

Thanks to Lightbend for their continued sponsorship of the Scala core team’s efforts. Lightbend offers commercial support for Scala.

Obtaining Scala

Scala releases are available through a variety of channels, including (but not limited to):

v2.13.0-RC1

5 years ago

Scala 2.13.0-RC1

Scala 2.13 is almost here! We are delighted to present the first 2.13 release candidate.

We and our crew of community contributors have mainly been polishing the improved and simplified Scala collections library that first shipped in 2.13.0-M4 and 2.13.0-M5. Some other sorts of changes got in as well; see below.

We ask all library maintainers to test and publish their libraries for RC1 as soon as possible. This is crucial to validate the release candidate and enable 2.13 to go forward.

About these notes

These are the detailed technical release notes for RC1 only, documenting changes since M5 only.

We don't yet have a combined, friendlier release note covering 2.13 as a whole yet. That will follow in time for 2.13.0. For now, see also the notes for M5, M4, M3, M2, and M1.

Binary compatibility

As usual for Scala pre-releases, RC1 is not binary compatible with any other Scala version, including 2.13 milestones.

We will not break binary compatibility between RC1 and 2.13.0 unless really necessary.

Libraries for Scala 2.13.0-RC1

As libraries are published for RC1, they're added to https://github.com/scala/make-release-notes/blob/2.13.x/projects-2.13.md .

Collections changes

To learn about the collections changes since 2.12 and how to adapt your code, take a look at these documents:

These documents are still being expanded and improved.

Here's the biggest recent collections changes, since M5:

  • Integrate converters from scala-java8-compat (#7458)
  • Make unified collection serialization opt-in instead of opt-out (#7624)
  • New mutable.HashSet and mutable.HashMap implementations (#7348)
  • Add CollisionProofHashMap, a mutable hashmap that degrades to red-black trees in the worst case (#7633)
  • Change LazyList to always evaluate elements in order, and to have lazy empty-or-not status (#7558)
  • Improved performance of small Vectors (#7743)
  • Add immutable TreeSeqMap (a SeqMap implemented via a customized IntMap/HashMap pair) (#7146)
  • Create trait collection.SeqMap (#7954)

The scala-parallel-collections module will be published for RC1. (Thank you @julienrf!)

License change

  • The license was changed to Apache 2.0 (#7306)

Language changes

  • Accept underscore as numeric literal separator (#6989)
  • Eta-expand 0-arity method if expected type is Function0 (#7660)
  • x op () now parses as x.op(()) not x.op() (#7684)
  • More precise inference for overloaded methods when arguments types align (#7631)
  • Disallow repeated param except in method signature (#7399)
  • By-name implicits: Align detection of implicit recursion with the SIP (#7368)
  • Enforce explicit return type for macros (#6942)

Compiler changes

  • Extension methods of overloads are themselves overloaded (#7896)
  • Emit mixin forwarders as bridges to avoid needing generic signatures (#7843)
  • Upgrade to ASM 7 for improved JDK 12 compat (#7384)
  • Make object fields static, and move post-super init to clinit (#7270)
  • More capable inliner (#7133)
  • Usability: compiler suggests possible names in NotAMemberError (#6711)

Compiler option changes

  • Replace -warn-option with -Woption (#7908)
  • Promote -deprecation to -Xlint:deprecation (#7714)
  • Deprecate -Xfuture (#7328)
  • Remove -Xmax-classfile-length; hard-code to 240 (#7497)

Concurrency changes

  • Significant performance improvements to Future (#7663)
  • Making the global EC a BatchedExecutor (performance) (#7470)
  • Add synchronous ("parasitic") ExecutionContext (#7784)

Standard library changes

  • Restore and use linesIterator to avoid conflict with JDK 11's String.lines (#7269)
  • Replace Cloneable/Serializable traits with type aliases (#6729)
  • Provide a simple string matcher as the dual of the simple string interpolator (#7387)
  • Introduce andThen overload which combines two partial functions (#7263)
  • Converters among optional Functions, PartialFunctions and extractor objects (#7111)
  • Add IterableOps#tapEach method (#7124)
  • Change Using to implement the loan pattern (#7468)
  • ControlThrowable never suppresses (#7413)

Deprecations and linting

  • Make postfixOps syntax an error (not just a warning) unless the feature is explicitly enabled (#6831)
  • Deprecate symbol literals (#7395)
  • Deprecate Unicode arrows , and (#7540)
  • Deprecate Proxy (#7880)
  • Deprecate 1l and lint 0755 (#7685)
  • Deprecate usecase scaladoc tag (#7462)
  • Deprecate Channel,SyncChannel,SyncVar and DelayedLazyVal (#7410)
  • Deprecate scala.compat.Platform (#7423)
  • Deprecate universal Equiv (#7414)
  • Annotation unused to suppress warnings (#7623)
  • Allow suppressing value-discard warning via type ascription to Unit (#7563)

Other changes

For more details, see merged PRs and closed bugs.

See also the notes for the previous milestones: M5, M4, M3, M2, M1.

Compiler performance in 2.13 is 5-10% better than 2.12. The integration of the new collections library shows up in the performance graph as a nice improvement.

Contributors

A big thank you to everyone who's helped improve Scala by reporting bugs, improving our documentation, spreading kindness in discussions around Scala, and submitting and reviewing pull requests! You are all magnificent.

This release was brought to you by 71 contributors, according to git shortlog -sn --no-merges ^v2.13.0-M5 ^2.12.x v2.13.0-RC1. Thank you Lukas Rytz, A. P. Marki, Jason Zaugg, Josh Lemer, Diego E. Alonso-Blas, Adriaan Moors, Kenji Yoshida, Stefan Zeiger, NthPortal, Guillaume Martres, Georgi Krastev, Viktor Klang, Dale Wijnand, Seth Tisue, hepin1989, exoego, Rex Kerr, Julien Richard-Foy, Eugene Yokota, Harrison Houghton, Miles Sabin, yui-knk, Philippus, Odd Möller, Aaron S. Hawley, Allan Renucci, Jasper Moeys, Sébastien Doeraene, Xavier GUIHOT, chanyong.moon, Matthias Sperl, Anthony Tjuatja, Enno Runne, Song Kun, Benjamin Kurczyk, ashwin, Kobenko Mikhail, Li Haoyi, Martijn Hoekstra, Mike Skells, 虎鸣, Alden Torres, Andrei Baidarov, Andriy Plokhotnyuk, Benni, Callum Turnbull, Chris Birchall, Chris Phelps, Cody Allen, Daniel Dietrich, Daniel Slapman, Denis Buzdalov, Denys Shabalin, Jack Koenig, Jean Michel Rouly, LPTK, Lionel Parreaux, Martin Duhem, Narek Asadorian, PJ Fanning, Philip, Qiang Sima, Ruud Welling, Ryan McDougall, ShankarShastri, Sperl Matthias, Uttej Guduru, Vincent de Haan, Vlastimil Dort, Yang Bo, ccjoywang, mdedetrich, psilospore, texasbruce, tim-zh.

Obtaining Scala

Scala releases are available through a variety of channels, including (but not limited to):

v2.12.8

5 years ago

This release fixes two regressions that appeared in 2.12.7:

  • Don't reject views with result types which are TypeVars (#7295)
  • Don't emit static forwarders (which simplify the use of methods in top-level objects from Java) for bridge methods (#7469)

The second fix is not binary compatible: the 2.12.8 compiler omits certain methods that are generated by earlier 2.12 compilers. However, we believe that these methods are never used and existing compiled code will continue to work. See the pull request description for more details.

Further highlights of this release:

  • The license was changed to Apache v2.0 (#7314)
  • Improved inference of parameter types for eta-expansion (#7340)
  • Emit detailed compiler trace under -Yprofile-trace (#7364)
  • Make the compiler output deterministic under incremental compilation (#7203)

For more details, check out all closed bugs and merged PRs.

As usual for minor releases, Scala 2.12.8 is binary compatible with the whole Scala 2.12 series.

Contributors

A big thank you to everyone who's helped improve Scala by reporting bugs, improving our documentation, spreading kindness in discussions around Scala, and submitting and reviewing pull requests! You are all magnificent.

This release was brought to you by 15 contributors, according to git shortlog -sn --no-merges v2.12.7..v2.12.8. Thank you Jason Zaugg, Adriaan Moors, Harrison Houghton, Miles Sabin, A. P. Marki, Janek Bogucki, Lukas Rytz, Georgi Krastev, Sujeet Kausallya Gholap, Dale Wijnand, psilospore, Mike Skells, Aaron S. Hawley, Eugene Yokota, Diego Alonso.

Thanks to Lightbend for their continued sponsorship of the Scala core team’s efforts. Lightbend offers commercial support for Scala.

Scala 2.12 Notes

The release notes for Scala 2.12.0 have important information applicable to the whole 2.12 series.

Obtaining Scala

Scala releases are available through a variety of channels, including (but not limited to):