Scala3 "-language" compiler option issues

Hopefully, it is a correct category to post to…

Hello everyone!

I am quite a bit surprised that in Scala3 the “-language” compiler option behaves way differently comparing to all Scala2 versions (I checked with majority of 2.12.x, 2.13.x and then 3.0.0 through 3.4.1).

For example, when I use it with Scala 2.13.13:

% scala-cli compile -S 2.13.13 -O -language:help -- empty.scala                       
Enable or disable language features
  dynamics             Allow direct or indirect subclasses of scala.Dynamic
  existentials         Existential types (besides wildcard types) can be written and inferred
  higherKinds          Allow higher-kinded types
  implicitConversions  Allow definition of implicit functions called views
  postfixOps           Allow postfix operator notation, such as `1 to 10 toList` (not recommended)
  reflectiveCalls      Allow reflective access to members of structural types
  experimental.macros  Allow macro definition (besides implementation and application)

Now, if I pass an incorrect option in there:

% scala-cli compile -S 2.13.13 -O -language:WRONG -- empty.scala
scalac error: 'WRONG' is not a valid choice for '-language'
  scalac -help  gives more information
Compilation failed

And those messages look pretty good to me.

However, if I try the same things with any of Scala3 versions, I get:

% scala-cli compile -S 3.4.1 -O -language:help -- empty.scala   
Enable one or more language features.

(no available options provided)

% scala-cli compile -S 3.4.1 -O -language:WRONG -- empty.scala

(no error reported, the file compiles successfully)

Also, just to make sure it is not a scala-cli issue, I tried this option in SBT – works pretty much the same way.

So I wonder – is such behavior a known/unknown bug or is such behavior expected for Scala3,
could you clarify please?

Thank you!

Definitely looks like a bug!

It’s a missing usability feature. Please file issue at scala/scala3, so that it is not forgotten.

Relatedly, there is (intentionally) no -language:_ or -language:all, but you can’t tell by testing. I don’t know if that is documented, or if it ought to be documented for migration.

1 Like

Thank you everyone!
The new issue is submitted: Scala3 `-language` compiler option issues · Issue #20083 · scala/scala3 · GitHub.