You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: This page lists the different flavours of language supported by the Scala 3 compiler.
5
+
num: 2
6
+
previous-page: overview
7
+
---
8
+
9
+
The default Scala language version currently supported by the Dotty compiler is `3.0`. There are also other language versions that can be specified instead:
10
+
11
+
-`3.0-migration`: Same as `3.0` but with a Scala 2 compatibility mode that helps moving Scala 2.13 sources over to Scala 3. In particular, it
12
+
13
+
- flags some Scala 2 constructs that are disallowed in Scala 3 as migration warnings instead of hard errors,
14
+
- changes some rules to be more lenient and backwards compatible with Scala 2.13
15
+
- gives some additional warnings where the semantics has changed between Scala 2.13 and 3.0
16
+
- in conjunction with `-rewrite`, offer code rewrites from Scala 2.13 to 3.0.
17
+
18
+
-`future`: A preview of changes introduced in the next versions after 3.0. In the doc pages here we refer to the language version with these changes as `3.1`, but it might be that some of these changes will be rolled out in later `3.x` versions.
19
+
20
+
Some Scala-2 specific idioms will be dropped in this version. The feature set supported by this version will be refined over time as we approach its release.
21
+
22
+
-`future-migration`: Same as `future` but with additional helpers to migrate from `3.0`. Similarly to the helpers available under `3.0-migration`, these include migration warnings and optional rewrites.
23
+
24
+
There are two ways to specify a language version.
25
+
26
+
- With a `-source` command line setting, e.g. `-source 3.0-migration`.
27
+
- With a `scala.language` import at the top of a source file, e.g:
28
+
29
+
```scala
30
+
packagep
31
+
importscala.language.`future-migration`
32
+
33
+
classC { ... }
34
+
```
35
+
36
+
Language imports supersede command-line settings in the source files where they are specified. Only one language import specifying a source version is allowed in a source file, and it must come before any definitions in that file.
0 commit comments