Skip to content

Commit 0dd24d0

Browse files
authored
Merge pull request #1598 from scala/release-3.4.0
Add 3.4.0 blogpost
2 parents 4df386e + 213ef9f commit 0dd24d0

File tree

5 files changed

+267
-2
lines changed

5 files changed

+267
-2
lines changed

_data/scala-releases.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1+
- category: current_version
2+
title: Current 3.4.x release
3+
version: 3.4.0
4+
release_date: February 29, 2024
15
- category: current_version
26
title: Current 3.3.x LTS release
3-
version: 3.3.1
4-
release_date: September 9, 2023
7+
version: 3.3.3
8+
release_date: February 29, 2024
59
- category: current_version
610
title: Current 2.13.x release
711
version: 2.13.13

_downloads/2024-02-29-3.3.3.md

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
title: Scala 3.3.3 LTS
3+
start: 29 February 2024
4+
layout: downloadpage
5+
release_version: 3.3.3
6+
release_date: "February 29, 2024"
7+
permalink: /download/3.3.3.html
8+
license: <a href="https://www.scala-lang.org/license/">Apache License, Version 2.0</a>
9+
api_docs: https://www.scala-lang.org/api/3.3.3/
10+
---

_downloads/2024-02-29-3.4.0.md

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
title: Scala 3.4.0
3+
start: 29 February 2024
4+
layout: downloadpage
5+
release_version: 3.4.0
6+
release_date: "February 29, 2024"
7+
permalink: /download/3.4.0.html
8+
license: <a href="https://www.scala-lang.org/license/">Apache License, Version 2.0</a>
9+
api_docs: https://www.scala-lang.org/api/3.4.0/
10+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,241 @@
1+
---
2+
layout: blog-detail
3+
post-type: blog
4+
by: Paweł Marks, VirtusLab
5+
title: Scala 3.4.0 and 3.3.3 LTS released!
6+
---
7+
8+
![Scala 3.4]({{ site.baseurl }}/resources/img/scala-3.4-launch.jpg)
9+
10+
We are thrilled to announce the release of two versions of Scala 3: the first version in the 3.4 minor line, and a patch version in the Long Term Support line.
11+
12+
## ... so which version should I update to?
13+
14+
Scala 3.4.0 code can use dependencies compiled with Scala 3.3.x, but not the other way around. That means that if you are a library author, you should stay on the LTS line. Moreover, you can safely bump the patch version of the LTS release and benefit from the bugfixes without forcing any updates on the consumers of your library, even in regard to the patch version.
15+
16+
If you are working on a project that is not meant to be used as an external dependency, feel free to update to Scala 3.4.0, especially if you are starting a new project.
17+
18+
Scala 3.4.0 and 3.3.3 share most of the changes since the 3.3.1 version. The difference is that Scala 3.4.0 adds new features and deprecates legacy mechanisms, while version 3.3.3 is focused solely on bug fixes and usability improvements. What's more, 3.3.3, as a part of the LTS line, maintains not only full binary compatibility but also full source compatibility. **We checked that every single one of over a thousand projects that worked with 3.3.1 still work with 3.3.3.** To achieve this, we had to be extra careful with selecting changes for that release. Thus, not every bug that is fixed in 3.4.0 is also fixed in 3.3.3. Some of the not-ported changes might still land in 3.3.4.
19+
20+
## ...wait, what happened to 3.3.2?
21+
22+
Unfortunately, [a subtle bug](https://github.com/playframework/playframework/issues/12418) in the TASTy reader managed to survive the Release Candidate (RC) process. The bug caused 3.3.2 to emit TASTy files incompatible with previous releases in the LTS line, namely 3.3.1 and 3.3.0. This means that, should a library author release a new version using 3.3.2, all users still based on older 3.3.x releases will encounter issues. While a simple workaround exists - users can bump their patch version in the LTS line, which is safe and recommended - we regard compatibility in the LTS as paramount. Therefore, we have decided to abandon the 3.3.2 release completely. New testing measures will be introduced to avoid such situations in the future and to guarantee that LTS line remains internally consistent in all cases.
23+
24+
## What's new in 3.3.3 LTS (and 3.4.0 too)
25+
26+
In the release notes of Scala [3.3.3 LTS](https://github.com/lampepfl/dotty/releases/tag/3.3.3), you can see a lot of bug fixes. One area that received special attention in that regard was coverage support. With most pains fixed, we are now confident in the state of coverage.
27+
28+
Another important change, not directly visible to end users, is the integration of the presentation compiler into the compiler itself. This makes building tooling easier and allows for a more stable and reliable user experience when using Metals.
29+
30+
## Changes exclusive to 3.4.0
31+
32+
Release notes of [3.4.0](https://github.com/lampepfl/dotty/releases/tag/3.4.0) contains many substantial changes and improvements. The most noteworthy can be grouped in a few broad categories:
33+
34+
### Stabilized SIPs
35+
36+
- [SIP-54](https://docs.scala-lang.org/sips/multi-source-extension-overloads.html) is now a standard feature. It allows for importing extension methods with the same name from different sources.
37+
- [SIP-53](https://docs.scala-lang.org/sips/quote-pattern-type-variable-syntax.html) is now a standard feature. It allows for more expressive type patterns in quotes. For example:
38+
39+
```scala
40+
case '[ (t, t, t) ] => ???
41+
```
42+
43+
will match any 3-element tuple, and `t` will be the greatest lower bound of types of all three elements.
44+
- Match types are now properly specified, and thanks to that, they work in a more predictable and stable way. See [SIP-56](https://docs.scala-lang.org/sips/match-types-spec.html)
45+
46+
### Improvements to the type system and inference
47+
48+
- Type inference for functions similar to fold is greatly improved. For example:
49+
50+
```scala
51+
def partition[T](xs: List[T], pred: T => Boolean) =
52+
xs.foldRight((Nil, Nil)): (x, p) =>
53+
if pred(x) then (x :: p._1, p._2) else (p._1, x :: p._2)
54+
55+
```
56+
57+
will have its return type correctly inferred as `(List[T], List[T])`. Earlier, it would result in a rather unintuitive type error.
58+
59+
- It is now possible to write a polymorphic lambda without writing down the types of its value parameters as long as they can be inferred from the context, for example:
60+
61+
```scala
62+
val f: [T] => T => String = [T] => (x: T) => x.toString
63+
```
64+
65+
can now be written more concisely as:
66+
67+
```scala
68+
val f: [T] => T => String = [T] => x => x.toString
69+
```
70+
71+
- The compiler now avoids generating given definitions that loop, removing a long-standing footgun in implicit resolution.
72+
73+
### Backend improvements
74+
75+
- Polymorphic lambdas are now implemented using JVM lambdas when possible instead of anonymous classes, which will make them more efficient.
76+
- JVM Backend parallelization has been ported from Scala 2 to Scala 3. Read more in the discussion under [the original PR](https://github.com/scala/scala/pull/6124).
77+
78+
### Reporting
79+
80+
- Scala 3.4 improves the error message when a signature from the classpath comes from an incompatible TASTy version. It has improved readability and provides a more useful diagnostic of what a user can do to fix the problem.
81+
82+
```
83+
error while loading Tuple,
84+
TASTy file /scala/Tuple.tasty could not be read, failing with:
85+
Forward incompatible TASTy file has version 28.4, produced by Scala 3.4.0,
86+
expected stable TASTy from 28.0 to 28.3.
87+
To read this TASTy file, use a Scala 3.4.0 compiler or newer.
88+
Please refer to the documentation for information on TASTy versioning:
89+
https://docs.scala-lang.org/scala3/reference/language-versions/binary-compatibility.html
90+
```
91+
92+
- If there is an error reading a class file, we now report the version of the classfile and a recommendation to check JDK compatibility:
93+
94+
```
95+
error while loading String,
96+
class file /modules/java.base/java/lang/String.class is broken (version 65.0),
97+
please check the JDK compatibility of your Scala version (3.4.0),
98+
reading aborted with class java.lang.RuntimeException:
99+
foo bar
100+
```
101+
102+
This will improve the user experience when the class file format changes unexpectedly. This feature will be backported to Scala 3.3.3.
103+
- Progress reporting of compilation is now visible in IDEs. Metals IDE users will notice that compilation progress is no longer frozen at 0% when using sbt or bloop as the BSP server. IntelliJ will also correctly report progress for BSP and sbt based projects.
104+
- Diagnostics (including unused warnings) are now exported to SemanticDB. That will allow better handling of warnings in tooling. See [#17835](https://github.com/lampepfl/dotty/pull/17835).
105+
106+
### Experimental changes
107+
108+
- An experimental `@publicInBinary` annotation can mark definitions that should be treated as a part of binary API. It is useful where some protected or private-in-package definitions are used in the inlined code. When they are marked, it is harder to accidentally break the binary compatibility by doing seemingly harmless refactoring. If the accompanying `-WunstableInlineAccessors` linting option is enabled. There will be a warning about using things not marked as binary API in inlined code. Originaly it was presented in [SIP-52](https://docs.scala-lang.org/sips/binary-api.html).
109+
- `-experimental` compiler flags will mark all top-level definitions as `@experimental`. This means that the experimental language features and definitions can be used in the project. Note that this does not change the strong guarantees of the stability of the non-experimental code. The experimental features can only be used in an experimental scope (transitively). In 3.5, we plan to allow using this flag also in the stable releases of the compiler.
110+
111+
### Legacy syntax deprecation
112+
113+
Following syntax is now deprecated and will report warnings when used:
114+
115+
- `_` type wildcards (rewrite to `?`)
116+
- `private[this]` (rewrite to `private`)
117+
- `var x = _` (rewrite to `var x = scala.compiletime.uninitialized`)
118+
- `with` as a type operator (rewrite to `&`)
119+
- `xs: _*` varargs (rewrite to `xs*`)
120+
- trailing `_` to force eta expansion (can be just omitted)
121+
122+
All those rewrites will be performed automatically by the compiler if you run it with `-rewrite -source 3.4-migration` flags. If you cannot make those rewrites in your codebase, you can suppress the warnings in single file by adding
123+
124+
```scala
125+
import scala.language.`3.3`
126+
```
127+
128+
or globally using the `-source 3.3` flag.
129+
130+
### Other source compatibility concerns
131+
132+
- Refutable patterns (i.e., patterns that might not match) in a for-comprehension generator must now be preceded by `case`, or an error is reported.
133+
134+
e.g.
135+
136+
```scala
137+
val xss = List(List(1, 2), List(3))
138+
139+
for y :: ys <- xss do println(y > 1)
140+
// ^^^^^^^
141+
// error: pattern's type ::[Int] is more specialized than the right hand
142+
// side expression's type List[Int]
143+
//
144+
// If the narrowing is intentional, this can be communicated by adding
145+
// the `case` keyword before the full pattern, which will result in a filtering
146+
// for expression (using `withFilter`).
147+
```
148+
149+
`.withFilter` is also no longer inserted for a pattern in a generator unless prefixed by `case`, meaning improved ergonomics for many types that do not implement `.withFilter`
150+
- Type inference has changed for `inline` methods in 3.4, which can cause a source incompatibility at the call site. The previous behaviour can be recovered in an affected file with
151+
152+
```scala
153+
import scala.language.`3.3`
154+
```
155+
156+
alternatively, the definition can be changed to `transparent inline`, but as this is a TASTy breaking change, it is not a default recommendation. (Also, `inline` should be preferred when possible over `transparent inline` for reduced binary size.)
157+
158+
## Contributors
159+
160+
Thank you to all the contributors who made the release of 3.4.0 and 3.3.3 LTS possible!
161+
162+
According to `git shortlog -sn --no-merges 3.3.1..3.4.0` these are:
163+
164+
```
165+
474 Martin Odersky
166+
296 Nicolas Stucki
167+
132 Fengyun Liu
168+
119 Dale Wijnand
169+
77 Jamie Thompson
170+
69 Sébastien Doeraene
171+
60 Paweł Marks
172+
32 Chris Kipp
173+
27 Guillaume Martres
174+
26 Rikito Taniguchi
175+
21 Yichen Xu
176+
19 EnzeXing
177+
14 Szymon Rodziewicz
178+
13 Lucas Leblanc
179+
12 Jakub Ciesluk
180+
12 Jędrzej Rochala
181+
12 Katarzyna Marek
182+
11 Carl
183+
10 David Hua
184+
9 Florian3k
185+
9 Wojciech Mazur
186+
8 Eugene Flesselle
187+
8 ghostbuster91
188+
7 Hamza Remmal
189+
7 Jan Chyb
190+
7 Ondrej Lhotak
191+
7 Quentin Bernet
192+
6 Julien Richard-Foy
193+
6 Kacper Korban
194+
6 Seth Tisue
195+
5 Lorenzo Gabriele
196+
5 Matt Bovel
197+
5 Som Snytt
198+
5 Yuito Murase
199+
5 dependabot[bot]
200+
3 David
201+
3 Lucas
202+
3 Pascal Weisenburger
203+
3 Tomasz Godzik
204+
2 Aleksander Rainko
205+
2 Decel
206+
2 Guillaume Raffin
207+
2 Ondřej Lhoták
208+
2 Oron Port
209+
2 danecek
210+
2 rochala
211+
1 Adam Dąbrowski
212+
1 Aleksey Troitskiy
213+
1 Arnout Engelen
214+
1 Ausmarton Zarino Fernandes
215+
1 Bjorn Regnell
216+
1 Daniel Esik
217+
1 Eugene Yokota
218+
1 Fabián Heredia Montiel
219+
1 François Monniot
220+
1 Jakub Cieśluk
221+
1 John Duffell
222+
1 John M. Higgins
223+
1 Justin Reardon
224+
1 Kai
225+
1 Kisaragi
226+
1 Lucas Nouguier
227+
1 Lukas Rytz
228+
1 LydiaSkuse
229+
1 Martin Kucera
230+
1 Martin Kučera
231+
1 Matthew Rooney
232+
1 Matthias Kurz
233+
1 Mikołaj Fornal
234+
1 Nicolas Almerge
235+
1 Preveen P
236+
1 Shardul Chiplunkar
237+
1 Stefan Wachter
238+
1 philippus
239+
1 q-ata
240+
1 slim
241+
```

resources/img/scala-3.4-launch.jpg

520 KB
Loading

0 commit comments

Comments
 (0)