Skip to content

Commit 895748b

Browse files
adpi2b-studios
authored andcommitted
Upgrade migration guide to Scala 3.0.0 and 2.13.6
1 parent 721dfbd commit 895748b

File tree

5 files changed

+35
-35
lines changed

5 files changed

+35
-35
lines changed

_overviews/scala3-migration/tooling-tour.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ Full-fledged support is being worked on by the team at JetBrains.
8282

8383
### Scalafmt
8484

85-
[Scalafmt](https://scalameta.org/scalafmt/) v3.0.0-RC1 supports both Scala 2.13 and Scala 3.
85+
[Scalafmt](https://scalameta.org/scalafmt/) v3.0.0-RC3 supports both Scala 2.13 and Scala 3.
8686

8787
To enable Scala 3 formatting you must set the `runner.dialect = scala3` in your `.scalafmt.conf` file.
8888

_overviews/scala3-migration/tutorial-macro-cross-building.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ In order to exemplify this tutorial, we will consider the minimal macro library
2424
lazy val example = project
2525
.in(file("example"))
2626
.settings(
27-
scalaVersion := "2.13.5",
27+
scalaVersion := "2.13.6",
2828
libraryDependencies ++= Seq(
2929
"org.scala-lang" % "scala-reflect" % scalaVersion.value
3030
)
@@ -69,7 +69,7 @@ The main idea is to build the artifact twice and to publish two releases:
6969
You can add Scala 3 to the list of `crossScalaVersions` of your project:
7070

7171
```scala
72-
crossScalaVersions := Seq("2.13.5", "3.0.0-RC3")
72+
crossScalaVersions := Seq("2.13.6", "3.0.0")
7373
```
7474

7575
The `scala-reflect` dependency won't be useful in Scala 3.
@@ -87,15 +87,15 @@ libraryDependencies ++= {
8787
}
8888
```
8989

90-
After reloading sbt, you can switch to the Scala 3 context by running `++3.0.0-RC3`.
91-
At any point you can go back to the Scala 2.13 context by running `++2.13.5`.
90+
After reloading sbt, you can switch to the Scala 3 context by running `++3.0.0`.
91+
At any point you can go back to the Scala 2.13 context by running `++2.13.6`.
9292

9393
## 2. Rearrange the code in version-specific source directories
9494

9595
If you try to compile with Scala 3 you should see some errors of the same kind as:
9696

9797
{% highlight text %}
98-
sbt:example> ++3.0.0-RC3
98+
sbt:example> ++3.0.0
9999
sbt:example> example / compile
100100
[error] -- Error: /example/src/main/scala/location/Location.scala:15:35
101101
[error] 15 | val location = typeOf[Location]
@@ -198,13 +198,13 @@ class MacrosSpec extends munit.FunSuite {
198198
You should now be able to run the tests in both versions.
199199

200200
{% highlight text %}
201-
sbt:example> ++2.13.5
201+
sbt:example> ++2.13.6
202202
sbt:example> example / test
203203
location.MacrosSpec:
204204
+ location
205205
[info] Passed: Total 1, Failed 0, Errors 0, Passed 1
206206
[success]
207-
sbt:example> ++3.0.0-RC3
207+
sbt:example> ++3.0.0
208208
sbt:example> example / test
209209
location.MacrosSpec:
210210
+ location

_overviews/scala3-migration/tutorial-macro-mixing.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,13 @@ However, in many cases you will have to move the Scala 2.13 macro implementation
8787

8888
lazy val example = project.in(file("example"))
8989
.settings(
90-
scalaVersion := "3.0.0-RC1"
90+
scalaVersion := "3.0.0"
9191
)
9292
.dependsOn(`example-compat`)
9393

9494
lazy val `example-compat` = project.in(file("example-compat"))
9595
.settings(
96-
scalaVersion := "2.13.5",
96+
scalaVersion := "2.13.6",
9797
libraryDependency += "org.scala-lang" % "scala-reflect" % scalaVersion.value
9898
)
9999
```
@@ -133,15 +133,15 @@ Since we want to execute the tests in Scala 2.13 and Scala 3, we create a cross-
133133
// build.sbt
134134
lazy val `example-test` = project.in(file("example-test"))
135135
.settings(
136-
scalaVersion := "3.0.0-RC1",
137-
crossScalaVersions := Seq("3.0.0-RC1", "2.13.5"),
136+
scalaVersion := "3.0.0",
137+
crossScalaVersions := Seq("3.0.0", "2.13.6"),
138138
scalacOptions ++= {
139139
CrossVersion.partialVersion(scalaVersion.value) match {
140140
case Some((2, 13)) => Seq("-Ytasty-reader")
141141
case _ => Seq.empty
142142
}
143143
},
144-
libraryDependencies += "org.scalameta" %% "munit" % "0.7.23" % Test
144+
libraryDependencies += "org.scalameta" %% "munit" % "0.7.26" % Test
145145
)
146146
.dependsOn(example)
147147
```
@@ -163,13 +163,13 @@ class MacrosSpec extends munit.FunSuite {
163163
You should now be able to run the tests in both versions.
164164

165165
{% highlight text %}
166-
sbt:example> ++2.13.5
166+
sbt:example> ++2.13.6
167167
sbt:example> example-test / test
168168
location.MacrosSpec:
169169
+ location
170170
[info] Passed: Total 1, Failed 0, Errors 0, Passed 1
171171
[success]
172-
sbt:example> ++3.0.0-RC1
172+
sbt:example> ++3.0.0
173173
sbt:example> example-test / test
174174
location.MacrosSpec:
175175
+ location
@@ -191,7 +191,7 @@ You are now ready to publish your library.
191191
It can be used in Scala 3 projects, or in Scala 2.13 projects with these settings:
192192

193193
```scala
194-
scalaVersion := "2.13.5"
194+
scalaVersion := "2.13.6"
195195
libraryDependencies += ("org" %% "example" % "x.y.z").cross(CrossVersion.for2_13Use3)
196196
scalacOptions += "-Ytasty-reader"
197197
```

_overviews/scala3-migration/tutorial-prerequisites.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ You can find all configured compiler plugins by looking at the compiler options
6969

7070
{% highlight text %}
7171
sbt:example> show example / Compile / scalacOptions
72-
[info] * -Xplugin:target/compiler_plugins/wartremover_2.13.5-2.4.12.jar
73-
[info] * -Xplugin:target/compiler_plugins/semanticdb-scalac_2.13.5-4.3.20.jar
72+
[info] * -Xplugin:target/compiler_plugins/wartremover_2.13.6-2.4.15.jar
73+
[info] * -Xplugin:target/compiler_plugins/semanticdb-scalac_2.13.6-4.4.18.jar
7474
[info] * -Yrangepos
7575
[info] * -P:semanticdb:targetroot:/example/target/scala-2.13/meta
7676
{% endhighlight %}

_overviews/scala3-migration/tutorial-sbt.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,16 @@ This is crucial to avoid bugs that could happen when fixing the incompatibilitie
4343
Configuring cross-building ins sbt is as short as:
4444

4545
```scala
46-
scalaVersion := "3.0.0-RC3"
47-
crossScalaVersions ++= Seq("2.13.5", "3.0.0-RC3")
46+
scalaVersion := "3.0.0"
47+
crossScalaVersions ++= Seq("2.13.6", "3.0.0")
4848
```
4949

5050
This configuration means:
51-
- The default version is `3.0.0-RC3`.
52-
- 2.13.5 can be loaded by running the `++2.13.5` command.
53-
- 3.0.0-RC3 can be loaded by running the `++3.0.0-RC3` command.
51+
- The default version is `3.0.0`.
52+
- 2.13.6 can be loaded by running the `++2.13.6` command.
53+
- 3.0.0 can be loaded by running the `++3.0.0` command.
5454

55-
Beware that the `reload` command will always load the default version---here it is 3.0.0-RC3.
55+
Beware that the `reload` command will always load the default version---here it is 3.0.0.
5656

5757
## 4. Prepare the dependencies
5858

@@ -77,20 +77,20 @@ Make sure the one you choose does not bring any breaking change.
7777
You can use the Scala 2.13 version of the library. The syntax is:
7878

7979
```scala
80-
("com.lihaoyi" %% "os-lib" % "0.7.3").cross(CrossVersion.for3Use2_13)
80+
("com.lihaoyi" %% "os-lib" % "0.7.7").cross(CrossVersion.for3Use2_13)
8181
```
8282

8383
Or for a Scala.js dependencies:
8484

8585
```scala
86-
("com.lihaoyi" %%% "os-lib" % "0.7.3").cross(CrossVersion.for3Use2_13)
86+
("com.lihaoyi" %%% "os-lib" % "0.7.7").cross(CrossVersion.for3Use2_13)
8787
```
8888

8989
Once you have fixed all the unresolved dependencies, you can check that the tests are still passing in Scala 2.13:
9090

9191
{% highlight text %}
92-
sbt:example> ++2.13.5
93-
[info] Setting Scala version to 2.13.5 on 1 project.
92+
sbt:example> ++2.13.6
93+
[info] Setting Scala version to 2.13.6 on 1 project.
9494
...
9595
sbt:example> example / test
9696
...
@@ -138,8 +138,8 @@ Also you should disable `-Xfatal-warnings` to take full advantage of the migrati
138138
It is now time to try compiling in Scala 3:
139139

140140
{% highlight text %}
141-
sbt:example> ++3.0.0-RC3
142-
[info] Setting Scala version to 3.0.0-RC3 on 1 project.
141+
sbt:example> ++3.0.0
142+
[info] Setting Scala version to 3.0.0 on 1 project.
143143
...
144144
sbt:example> example / compile
145145
...
@@ -171,8 +171,8 @@ This is particularly crucial if your project is a published library.
171171
After fixing an incompatibility, you can validate the solution by running the tests in Scala 2.13.
172172

173173
{% highlight text %}
174-
sbt:example> ++2.13.5
175-
[info] Setting Scala version to 2.13.5 on 1 project.
174+
sbt:example> ++2.13.6
175+
[info] Setting Scala version to 2.13.6 on 1 project.
176176
...
177177
sbt:example> example / test
178178
...
@@ -186,7 +186,7 @@ Only the migration warnings are remaining.
186186
You can patch them automatically by compiling with the `-source:3.0-migration -rewrite` options.
187187

188188
{% highlight text %}
189-
sbt:example> ++3.0.0-RC3
189+
sbt:example> ++3.0.0
190190
sbt:example> set example / scalacOptions += "-rewrite"
191191
sbt:example> example / compile
192192
...
@@ -206,11 +206,11 @@ Good tests are the only guarantee to prevent such bugs from going unnoticed.
206206
Make sure that the tests are passing in both Scala 2.13 and Scala 3.
207207

208208
{% highlight text %}
209-
sbt:example> ++2.13.5
209+
sbt:example> ++2.13.6
210210
sbt:example> example / test
211211
...
212212
[success]
213-
sbt:example> ++3.0.0-RC3
213+
sbt:example> ++3.0.0
214214
sbt:example> example / test
215215
...
216216
[success]

0 commit comments

Comments
 (0)