Skip to content

FAQ: revise entry on Scala versionNumberString #2482

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions _overviews/FAQ/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,20 +108,25 @@ Your sbt 1.x build definition is always a Scala 2.12 program.
Regardless, in your `build.sbt`, you can set `scalaVersion` to whichever
available distribution you want and your program code will be compiled with that version.

### I want Scala 3.1.1 (etc); why does std lib say it's using Scala 2.13?
### I want Scala 3. Why does `versionNumberString` say I'm on 2.13?

Scala 3 currently uses the Scala 2.13 library by leveraging its seamless
interoperability. Note that it does not necessarily ingest the latest
version of the Scala 2.13 library.
To aid migration, Scala 3 currently uses the Scala 2.13 library as-is,
with only minor supplements. That's why `versionString` and
`versionNumberString` report that Scala 2 is in use:

```
Welcome to Scala 3.1.1 (17.0.2, Java OpenJDK 64-Bit Server VM).
Welcome to Scala 3.1.3 (17.0.3, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.

scala> util.Properties.versionString
val res0: String = version 2.13.6
scala> util.Properties.versionNumberString
val res0: String = 2.13.8
```

Note that Scala 3 offers
`dotty.tools.dotc.config.Properties.versionNumberString`, but only if
you have scala3-compiler on the classpath. So that works in the Scala 3
REPL, but won't work in typical Scala 3 application code.

### Why is my (abstract or overridden) `val` null?

<!-- this is left over from a previous version of the FAQ.
Expand Down