Skip to content

Commit 8c1ff35

Browse files
committed
Create docs.scala-lang.org/scala3/guides/reference and move language-versions here
Content was taken from commit 270bd8b0f5af338be73790082d774516a83a73b5
1 parent 4567802 commit 8c1ff35

File tree

4 files changed

+57
-1
lines changed

4 files changed

+57
-1
lines changed

_config.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,15 @@ defaults:
123123
overview-name: "Macros in Scala 3"
124124
layout: multipage-overview
125125
permalink: "/scala3/guides/macros/:title.html"
126+
-
127+
scope:
128+
path: "_overviews/scala3-reference"
129+
values:
130+
scala3: true
131+
partof: scala3-reference
132+
overview-name: "Scala 3 Language Reference"
133+
layout: multipage-overview
134+
permalink: "/scala3/guides/reference/:title.html"
126135
-
127136
scope:
128137
path: "scala3"
@@ -133,7 +142,7 @@ defaults:
133142
highlighter: rouge
134143
permalink: /:categories/:title.html:output_ext
135144
baseurl:
136-
scala3ref: "https://dotty.epfl.ch/docs/reference"
145+
scala3ref: "/scala3/guides/reference"
137146
exclude: ["vendor"]
138147
plugins:
139148
- jekyll-redirect-from
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
title: Language Versions
3+
type: chapter
4+
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+
package p
31+
import scala.language.`future-migration`
32+
33+
class C { ... }
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.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
title: Overview
3+
type: chapter
4+
description: This page begins the reference documentation.
5+
num: 1
6+
next-page: language-versions
7+
---

scala3/guides.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ guides:
1818
icon: birthday-cake
1919
url: "/scala3/guides/tasty-overview.html"
2020
description: "An overview over the TASTy format aimed at end-users of the Scala language."
21+
- title: Scala 3 Language Reference
22+
icon: book
23+
url: "/scala3/guides/reference/overview.html"
24+
description: "The reference for Scala 3"
2125
---
2226

2327
<section class="full-width">

0 commit comments

Comments
 (0)