Skip to content
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

Scala3 -language compiler option issues #20083

Closed
satorg opened this issue Apr 3, 2024 · 1 comment · Fixed by #20247
Closed

Scala3 -language compiler option issues #20083

satorg opened this issue Apr 3, 2024 · 1 comment · Fixed by #20247
Assignees
Labels
area:settings Issues tied to command line options & settings. area:ux Issues tied to user experience. itype:enhancement

Comments

@satorg
Copy link

satorg commented Apr 3, 2024

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
@satorg satorg added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Apr 3, 2024
@som-snytt
Copy link
Contributor

Especially as there is no -language:all equivalent to -language:_, which is what you reach for when doing a quick test and can't be bothered with spelling it out. There is no indicator at all.

No doubt, when the dust settles around other important features and people begin to miss -language:_, there will be a general mutiny.

An alternative would be a -language:test environment that relaxes all sorts of restrictions but just for testing. I can't think of one, but could imagine "empty package" available only under this test regime, or empty packages from arbitrary sources (directories or binary artifacts).

@Gedochao Gedochao added itype:enhancement area:settings Issues tied to command line options & settings. area:ux Issues tied to user experience. and removed itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Apr 4, 2024
noti0na1 added a commit that referenced this issue May 14, 2024
Fix #20083: Enhance help message for language features by displaying all available choises and notes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:settings Issues tied to command line options & settings. area:ux Issues tied to user experience. itype:enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants