Scala
Scala 2 compiler and standard library. Scala 2 bugs at https://github.com/scala/bug; Scala 3 at https://github.com/scala/scala3
Install / Use
/learn @scala/ScalaREADME
This is Scala 2! Welcome!
This is the home of the Scala 2 standard library, compiler, and language spec.
For Scala 3, visit scala/scala3.
How to contribute
Issues and bug reports for Scala 2 are located in scala/bug. That tracker is also where new contributors may find issues to work on: good first issues, help wanted.
For coordinating broader efforts, we also use the scala/scala-dev tracker.
To contribute here, please open a pull request from your fork of this repository.
Be aware that we can't accept additions to the standard library, only modifications to existing code. Binary compatibility forbids adding new public classes or public methods. Additions are made to scala-library-next instead.
We require that you sign the Scala CLA before we can merge any of your work, to protect Scala's future as open source software.
The general workflow is as follows.
- Find/file an issue in scala/bug (or submit a well-documented PR right away!).
- Fork the scala/scala repo.
- Push your changes to a branch in your forked repo. For coding guidelines, go here.
- Submit a pull request to scala/scala from your forked repo.
For more information on building and developing the core of Scala, read the rest of this README, especially for setting up your machine!
Get in touch!
In order to get in touch with other Scala contributors, join the #scala-contributors channel on the Scala Discord chat, or post on contributors.scala-lang.org (Discourse).
If you need some help with your PR at any time, please feel free to @-mention anyone from the list below, and we will do our best to help you out:
| | username | talk to me about... |
--------------------------------------------------------------------------------------------------|----------------------------------------------------------------|---------------------------------------------------|
<img src="https://avatars.githubusercontent.com/lrytz" height="50px" title="Lukas Rytz"/> | @lrytz | back end, optimizer, named & default arguments, reporters |
<img src="https://avatars.githubusercontent.com/retronym" height="50px" title="Jason Zaugg"/> | @retronym | compiler performance, weird compiler bugs, lambdas |
<img src="https://avatars.githubusercontent.com/SethTisue" height="50px" title="Seth Tisue"/> | @SethTisue | getting started, build, CI, community build, Jenkins, docs, library, REPL |
<img src="https://avatars.githubusercontent.com/dwijnand" height="50px" title="Dale Wijnand"/> | @dwijnand | pattern matcher, MiMa, partest |
<img src="https://avatars.githubusercontent.com/som-snytt" height="50px" title="Som Snytt"/> | @som-snytt | warnings/lints/errors, REPL, compiler options, compiler internals, partest |
<img src="https://avatars.githubusercontent.com/Ichoran" height="50px" title="Rex Kerr"/> | @Ichoran | collections library, performance |
<img src="https://avatars.githubusercontent.com/viktorklang" height="50px" title="Viktor Klang"/> | @viktorklang | concurrency, futures |
<img src="https://avatars.githubusercontent.com/sjrd" height="50px" title="Sébastien Doeraene"/> | @sjrd | interactions with Scala.js |
<img src="https://avatars.githubusercontent.com/bishabosha" height="50px" title="Jamie Thompson"/> | @bishabosha | TASTy reader |
<img src="https://avatars.githubusercontent.com/joroKr21" height="50px" title="Georgi Krastev"/> | @joroKr21 | higher-kinded types, implicits, variance |
P.S.: If you have some spare time to help out around here, we would be delighted to add your name to this list!
Branches
Target the oldest branch you would like your changes to end up in. We periodically merge forward from 2.12.x to 2.13.x. Most changes should target 2.13.x, as 2.12.x is now under minimal maintenance.
If your change is difficult to merge forward, you may be asked to also submit a separate PR targeting the newer branch.
If your change is version-specific and shouldn't be merged forward, put [nomerge] in the PR name.
If your change is a backport from a newer branch and thus doesn't need to be merged forward, put [backport] in the PR name.
Choosing a branch
Most changes should target 2.13.x. We are increasingly reluctant to target 2.12.x unless there is a special reason (e.g. if an especially bad bug is found, or if there is commercial sponsorship). See Scala 2 maintenance.
Repository structure
Most importantly:
scala/
+--build.sbt The main sbt build definition
+--project/ The rest of the sbt build
+--src/ All sources
+---/library Scala Standard Library
+---/reflect Scala Reflection
+---/compiler Scala Compiler
+--test/ The Scala test suite
+---/files Partest tests
+---/junit JUnit tests
+---/scalacheck ScalaCheck tests
+--spec/ The Scala language specification
but also:
scala/
+---/library-aux Scala Auxiliary Library, for bootstrapping and documentation purposes
+---/interactive Scala Interactive Compiler, for clients such as an IDE (aka Presentation Compiler)
+---/manual Scala's runner scripts "man" (manual) pages
+---/partest Scala's internal parallel testing framework
+---/partest-javaagent Partest's helper java agent
+---/repl Scala REPL core
+---/repl-frontend Scala REPL frontend
+---/scaladoc Scala's documentation tool
+---/scalap Scala's class file decompiler
+---/testkit Scala's unit-testing kit
+--admin/ Scripts for the CI jobs and releasing
+--doc/ Additional licenses and copyrights
+--scripts/ Scripts for the CI jobs and releasing
+--tools/ Scripts useful for local development
+--build/ Build products
+--dist/ Build products
+--target/ Build products
Get ready to contribute
Requirements
You need the following tools:
- Java SDK. The baseline version is 8 for both 2.12.x and 2.13.x. It is almost always fine to use a later SDK (such as 17 or 21) for local development. CI will verify against the baseline version.
- sbt
MacOS and Linux work. Windows may work if you use Cygwin. Community help with keeping the build working on Windows and documenting any needed setup is appreciated.
Tools we use
We are grateful for the following OSS licenses:
Build setup
Basics
During ordinary development, a new Scala build is built by the previously released version, known as the "reference compiler" or, slangily, as "STARR" (stable reference release). Building with STARR is sufficient for most kinds of changes.
However, a full build of Scala is bootstrapped. Bootstrapping has two steps: first, build with STARR; then, build again using the freshly built compiler, leaving STARR behind. This guarantees that every Scala version can build itself.
If you change the code generation part of the Scala compiler, your changes will only show up in the bytecode of the library and compiler after a bootstrap. Our CI does a bootstrapped build.
Bootstrapping locally: To perform a bootstrap, run restarrFull
within an sbt session. This will build and publish the Scala
distribution to your local artifact repository and then switch sbt to
use that version as its new scalaVersion. You may then revert back
with reload. Note restarrFull will also write the STARR version
to buildcharacter.properties so you can switch back to it with
restarr without republishing. This will switch the sbt session to
use the build-restarr and target-restarr directories instead of
build and target, which avoids wiping out classfiles and
incremental metadata. IntelliJ will continue to be configured to
compile and run tests using the starr version in
versions.properties.
For history on how the current scheme was arrived at, see https://groups.google.com/d/topic/scala-internals/gp5JsM1E0Fo/discussion.
Building with fatal warnings: To make warnings in the project fatal (i.e. turn them into errors), run set Global / fatalWarnings := true in sbt (replace Global with the name of a module—such as reflect—
