Edit this page on GitHub

Getting Started

Scala CLA

Sometime before submitting your pull request you'll want to make sure you have signed the Scala CLA. You can read more about why we require a CLA and what exactly is included in it here.

Making sure the team is aware

Before digging into an issue or starting on a new feature it's a good idea to make sure an issue or a discussion has been created outlining what you plan to work on. This is both for your and the team's benefit. It ensures you get the help you need, and also gives the compiler team a heads-up that someone is working on an issue.

For some small changes like documentation, this isn't always necessary, but it's never a bad idea to check.

Requirements

  • git is essential for managing the Scala 3 code, and contributing to GitHub, where the code is hosted.
  • A Java Virtual Machine (JDK 8 or higher), required for running the build tool.
  • sbt, the build tool required to build the Scala 3 compiler and libraries.

Nice To Have

An IDE, such as Metals will help you develop in Scala 3 with features such as autocompletion, code navigation, debugging, and interactive worksheets.

Another popular options is IntelliJ IDEA for Scala.

Compiling and Running

Start by cloning the repository:

$ git clone https://github.com/scala/scala3.git
$ cd scala3

Dotty provides a standard sbt build: compiling, running and starting a repl can all be done from within sbt:

$ sbt
> scalac tests/pos/HelloWorld.scala
> scala HelloWorld
hello world

There are also bash scripts that can be used in the same way. Assuming that you have cloned the Dotty repo locally, append the following line on your .bash_profile, or equivalent for your shell:

$ export PATH=<path to cloned dotty>/bin:$PATH

and you will be able to run the corresponding commands directly from your console:

# Compile code using Dotty
$ scalac tests/pos/HelloWorld.scala

# Run it with the proper classpath
$ scala HelloWorld

Note that the scalac and scala scripts have slow roundtrip times when working on the compiler codebase: whenever any source file changes they invoke sbt dist/pack first.

As an alternative, run the buildQuick task in sbt. It builds the compiler and writes its classpath to the bin/.cp file, which enables the scalacQ and scalaQ scripts in the bin/ folder.

Starting a REPL

$ sbt
> repl
Welcome to Scala.next (pre-alpha)  (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_101).
Type in expressions to have them evaluated.
Type :help for more information.
scala>

or via bash:

$ scala

Publish to local repository

To test our cloned compiler on local projects:

$ sbt publishLocal

Then in the build.sbt file of a test project:

ThisBuild / scalaVersion := "<dotty-version>-bin-SNAPSHOT"

where dotty-version can be found in the file project/Build.scala, like 3.0.0-M2

Generating Documentation

To generate this page and other static page docs, run

$ sbt
> scaladoc/generateScalaDocumentation

For more information, see the scaladoc section.

Community

The main development discussion channels are: