Skip to content

Commit 4297425

Browse files
committed
small tweaks to -Xsource:3 doc page
1 parent 96ced05 commit 4297425

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

_overviews/scala3-migration/tooling-scala2-xsource3.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,19 @@ next-page: tooling-migration-mode
88
---
99

1010
The Scala 2.13 compiler issues helpful migration warnings with the `-Xsource:3` flag.
11+
1112
Before moving to the Scala 3 compiler, it's recommended to enable this flag in Scala 2 and address the new warnings.
12-
In addition to new warnings, the flag enables certain benign Scala 3 syntaxes such as `import p.*`.
1313

14-
This page explains the details behind the flag, an overview is shown using `scalac -Xsource:help`.
14+
There is also a variant, `-Xsource:3-cross`; see below.
15+
16+
This page explains the details behind the flags. An overview is shown using `scalac -Xsource:help`.
1517

1618
## Migration vs cross-building
1719

1820
With Scala 2.13.13 and newer, the `-Xsource:3` flag comes in two variants:
1921

2022
- `Xsource:3` enables warnings relevant for migrating a codebase to Scala 3.
23+
In addition to new warnings, the flag enables certain benign Scala 3 syntaxes such as `import p.*`.
2124
- `Xsource:3-cross` is useful for projects that cross-build between Scala 2 and 3 for a longer period of time.
2225
For certain language constructs that trigger a warning with `-Xsource:3`, the behavior changes to match Scala 3.
2326

@@ -37,7 +40,7 @@ See also `scalac -quickfix:help`.
3740

3841
## Enabled Scala 3 syntax
3942

40-
The `-Xsource:3` flag enables the following Scala 3 syntax in Scala 2:
43+
The `-Xsource:3` flag enables the following Scala 3 syntaxes in Scala 2:
4144

4245
- `import p.*`
4346
- `import p.m as n`
@@ -46,7 +49,6 @@ The `-Xsource:3` flag enables the following Scala 3 syntax in Scala 2:
4649
- `A & B` type intersection as an alias for `A with B`
4750
- Selecting a method `x.f` performs an eta-expansion (`x.f _`), even without an expected type
4851

49-
5052
## Scala 3 migration warnings in detail
5153

5254
Many Scala 3 migration warnings are easy to understand and identical under `-Xsource:3` and `-Xsource:3-cross`, e.g., for implicit definitions without an explicit type:

0 commit comments

Comments
 (0)