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
Copy file name to clipboardExpand all lines: _posts/2025-05-07-release-notes-3.7.0.md
+60-8Lines changed: 60 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -237,13 +237,13 @@ Under `-source:3.7-migration`, code whose behaviour differs between new and old
237
237
238
238
For detailed motivation of the changes, with examples of code that will be easier to write and understand, see our 2024 blog post - [Upcoming Changes to Givens in Scala 3.7]({{ site.baseurl }}/2024/08/19/given-priority-change-3.7.html).
239
239
240
-
### Expression Compiler is now part of Scala 3 compiler [#22597](https://github.com/scala/scala3/pull/22597)
240
+
### Expression Compiler is now part of Scala 3 compiler ([#22597](https://github.com/scala/scala3/pull/22597))
241
241
242
242
The expression compiler powers the debug console in Metals and the IntelliJ Scala plugin, enabling the evaluation of arbitrary Scala expressions at runtime (even macros). The expression compiler produces class files that can be loaded by tooling to compute the evaluation output.
243
243
Previously expression compiler was developed independently from the Scala compiler inside [scalacenter/scala-debug-adapter](https://github.com/scalacenter/scala-debug-adapter) repository and was cross-published for every Scala release.
244
244
Starting with Scala 3.7 the expression compiler has been migrated to the main [scala/scala3](https://github.com/scala/scala3) repository and become an integral part of Scala toolchain. This change allows users to use the expression compiler with nightly versions of the compiler as well, easing the maintenance and release process for the compiler team.
245
245
246
-
### Presentation Compiler: Show inferred type on holes in hover [#21423](https://github.com/scala/scala3/pull/21423)
246
+
### Presentation Compiler: Show inferred type on holes in hover ([#21423](https://github.com/scala/scala3/pull/21423))
247
247
248
248
The presentation compiler is a special mode of the Scala compiler that runs interactively and is used by IDEs and language servers such as Metals. It provides immediate feedback about code correctness, type checking, symbol resolution, autocompletion, error highlighting, and other editing support functionalities.
249
249
Some of the latest improvements to the presentation compiler focus on the ability to infer more information about expected types of expressions provided by the users. As a result, presentation compiler can now show the users the expected type of expression when hovering over so called `type holes`.
@@ -299,7 +299,7 @@ object Show {
299
299
300
300
Furthermore, the experimental `Symbol.newClass` method has been extended to support class parameters, flags, privateWithin, and annotations ([#21880](https://github.com/scala/scala3/pull/21880)). This enhancement enables the dynamic creation of classes with constructors, access modifiers, and annotations, providing greater control over generated code structures. With those changes included, we are planning to stabilize this method (and `ClassDef.apply`) soon.
301
301
302
-
### Improvements to `-Wunused` and `-Wconf`[#20894](https://github.com/scala/scala3/pull/20894)
302
+
### Improvements to `-Wunused` and `-Wconf`([#20894](https://github.com/scala/scala3/pull/20894))
303
303
304
304
Scala 3.7 introduces a significant enhancement to its linting mechanism by revamping the `CheckUnused` compiler phase. Previously, developers encountered false-positive warnings when importing givens, particularly when they were defined in shared traits across multiple objects. This issue often led to unnecessary code restructuring or the disabling of linting checks.
305
305
@@ -313,7 +313,7 @@ Changes also enhance the `-Wconf` option to allow origin-based filtering `-Wconf
313
313
314
314
These improvements collectively provide developers with more precise and configurable linting tools, enhancing code quality and maintainability.
315
315
316
-
### Implicit parameters now warn at call site without `using` keyword [#22441](https://github.com/scala/scala3/pull/22441)
316
+
### Implicit parameters now warn at call site without `using` keyword ([#22441](https://github.com/scala/scala3/pull/22441))
317
317
318
318
As part of Scala's ongoing migration from `implicit` to the newer, clearer `given` and `using`, Scala 3.7 introduces a change regarding method calls involving implicit parameters. Now, explicitly providing arguments to methods defined with `implicit` warns if the call site doesn't say `using`. This adjustment reduces ambiguity inherent in Scala 2 syntax, where it was unclear whether an explicitly provided argument was intended for an implicit parameter or for the apply method of the resulting object.
Scala 3.7 provides an automated migration path for existing codebases through the compiler flags -rewrite -source:3.7-migration, which automatically inserts the recommended `using` keywords, streamlining the transition to the new syntax.
337
337
Users of Scala 2 can introduce the `using` syntax at callsite into their codebase as well. The implicit based example above would successfully compile when using at least Scala 2.12.17 or Scala 2.13.9 without any additional flags.
338
338
339
-
### Scala 3 unblocked on Android [#22632](https://github.com/scala/scala3/pull/22632)
339
+
### Scala 3 unblocked on Android ([#22632](https://github.com/scala/scala3/pull/22632))
340
340
341
341
Scala 3.7 brings a crucial fix that enhances its compatibility with the Android platform. Previously, developers faced issues when compiling Scala 3 code for Android due to the Android Runtime (ART) enforcing stricter type constraints on lambdas than the standard Java Virtual Machine (JVM). Specifically, ART requires that the return type of a Single Abstract Method (SAM) interface be a primitive type or explicitly boxed, a condition not mandated by the JVM.
342
342
343
343
The update addresses this by modifying the Scala compiler to box the return type of native instantiated methods when the SAM's return type isn't primitive. This change ensures that lambda expressions conform to ART's expectations, preventing runtime errors on Android devices. By aligning the compiler's behaviour with ART's requirements, the Scala 3 development for the Android platform should be unblocked, although it might require recompiling existing libraries using Scala 3.7 or the upcoming Scala 3.3 LTS version containing a backported fix.
344
344
345
-
### Support for dependent case classes [#21698](https://github.com/scala/scala3/pull/21698)
345
+
### Support for dependent case classes ([#21698](https://github.com/scala/scala3/pull/21698))
346
346
347
347
Case classes may now have dependent fields, improving expressiveness and type safety. This allows fields within a case class to depend on other constructor parameters via path-dependent types. One use case is encoding a configuration system where each setting has a distinct value type determined by the setting itself.
348
348
@@ -372,6 +372,54 @@ class IntSetting(name: String) extends Setting(name):
372
372
373
373
This enhancement simplifies type-safe heterogeneous collections and makes it easier to express advanced design patterns previously requiring workarounds or more verbose type definitions.
374
374
375
+
Be aware of some pattern matching limitations for dependent case classes - the types of the extracted components are currently approximated to their non-dependent upper-bound:
376
+
377
+
```scala
378
+
traitA:
379
+
typeB<:AnyRef
380
+
381
+
caseclassCC(a: A, b: a.B)
382
+
objectTest:
383
+
deffoo(cc: CC) = cc match
384
+
caseCC(a, b) =>
385
+
// `a` has type `A`
386
+
// `b` has type `AnyRef` instead of the more precise `a.B`
387
+
```
388
+
389
+
### REPL: bring dependencies in with `:jar` ([#22343](https://github.com/scala/scala3/pull/22343))
390
+
391
+
It is now possible to bring new dependencies to an already running REPL session with the `:jar` command. It is effectively the equivalent of Scala 2’s `:require`.
392
+
393
+
For example, for a given simple example:
394
+
395
+
```scala
396
+
// example.scala
397
+
objectMessage:
398
+
valhello="Hello"
399
+
```
400
+
401
+
After packaging it into a JAR:
402
+
403
+
```bash
404
+
scala package example.scala --power --library
405
+
# Compiling project (Scala 3.7.0, JVM (24))
406
+
# Compiled project (Scala 3.7.0, JVM (24))
407
+
# Wrote example.jar
408
+
```
409
+
410
+
It's possible to bring it into a running REPL session like this:
411
+
412
+
```scala
413
+
Welcome to Scala3.7.0(23.0.1, JavaOpenJDK64-BitServerVM).
414
+
Type in expressions for evaluation. Ortry:help.
415
+
416
+
scala>:jar example.jar
417
+
Added'example.jar' to classpath.
418
+
419
+
scala>Message.hello
420
+
valres0:String=Hello
421
+
```
422
+
375
423
### Dependency updates
376
424
377
425
#### Scala 2 Standard Library
@@ -396,7 +444,11 @@ Please refer to Scala.js changelogs for more details:
396
444
#### Scala CLI
397
445
398
446
The Scala runner has been updated to Scala CLI 1.7.1.
399
-
The new Scala runner uses `scalafmt` binaries built using Scala Native for `fmt` subcommand. This change can improve the performance of formatting Scala sources. It also includes experimental support for running `scalafix` rules using `scala fix` subcommand.
447
+
448
+
Notable changes include:
449
+
450
+
* The `fmt` sub-command now uses `scalafmt` binaries built with Scala Native. This change can improve the performance of formatting Scala sources.
451
+
* (⚡️ experimental) Support for running `scalafix` rules has been added to the `fix` sub-command.
400
452
401
453
Please refer to Scala CLI changelogs for more details:
402
454
@@ -407,7 +459,7 @@ Please refer to Scala CLI changelogs for more details:
407
459
408
460
# What’s next?
409
461
410
-
With the final release of Scala 3.7.0, the first patch version—Scala 3.7.1-RC1—has already been made available. This release includes additional fixes and improvements introduced after the branch cutoff.
462
+
With the final release of Scala 3.7.0, the first patch version[3.7.1-RC1](https://github.com/scala/scala3/releases/tag/3.7.1-RC1)has already been made available. This release includes additional fixes and improvements introduced after the branch cutoff.
411
463
412
464
Looking ahead, you can expect at least two more patch releases before Scala 3.8, which is scheduled for September 2025. The goal for Scala 3.8 is to be the last minor version before the next Long-Term Support (LTS) release, Scala 3.9, which is planned for early 2026.
0 commit comments