Skip to content

Scala3 -language compiler option issues #20083

Closed
@satorg

Description

@satorg

First discussed on Scala Contributors

Compiler version

All Scala3 versions v3.0.0 through v3.4.1

Minimized code

The -language compiler option does not behave as expected:

  1. -language:help does not provide available choices:

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

    (no available choices returned)

  2. -language with an incorrect choice does not fail compilation:

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

    (no errors reported, the file compiles successfully)

Expectation

The behavior should look similar to Scala2 compilers, e.g.:

% 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)

% 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

Metadata

Metadata

Assignees

Labels

area:settingsIssues tied to command line options & settings.area:uxIssues tied to user experience.itype:enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions