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

Enhance help message for language flag #20247

Merged
merged 7 commits into from
May 14, 2024

Conversation

noti0na1
Copy link
Member

@noti0na1 noti0na1 commented Apr 22, 2024

Partial fix #20083

Enhance help message for language flag by displaying all available choises

> scalac -language:help
-language  Enable one or more language features.
           Choices : 
           - help :
                Display all available features, 
           - noAutoTupling :
                Disable automatic tupling, 
           - dynamics :
                Allow direct or indirect subclasses of scala.Dynamic, 
           - unsafeNulls :
                Enable unsafe nulls for explicit nulls, 
           - postfixOps :
                Allow postfix operators (not recommended), 
           - strictEquality :
                Enable strict equality (disable canEqualAny), 
           - implicitConversions :
                Allow implicit conversions without warnings, 
           - adhocExtensions :
                Allow ad-hoc extension methods, 
           - experimental.namedTypeArguments :
                Allow named type arguments, 
           - experimental.genericNumberLiterals :
                Allow generic number literals, 
           - experimental.macros :
                Allow Scala 2 macros, 
           - experimental.dependent :
                Allow dependent method types, 
           - experimental.erasedDefinitions :
                Allow erased definitions, 
           - deprecated.symbolLiterals :
                Allow symbol literals, 
           - experimental.fewerBraces :
                Enable support for using indentation for arguments, 
           - experimental.saferExceptions :
                Enable safer exceptions, 
           - experimental.clauseInterleaving :
                Enable clause interleaving, 
           - experimental.pureFunctions :
                Enable pure functions for capture checking, 
           - experimental.captureChecking :
                Enable experimental capture checking, 
           - experimental.into :
                Allow into modifier on parameter types

@Gedochao
Copy link
Contributor

@noti0na1 perhaps we could align the output with the way Scala 2 compiler does it?

scalac2 -language:help # scalac2 is an alias for the Scala 2 compiler command here
# 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)

Also, optimally we'd like passing inputs to not be necessary with a help flag (so no empty.scala should be necessary)

@noti0na1 noti0na1 force-pushed the enhance-language-flag-help branch from 65dc34f to da00b3d Compare May 2, 2024 15:40
@noti0na1 noti0na1 marked this pull request as ready for review May 6, 2024 12:08
@noti0na1 noti0na1 requested review from som-snytt and odersky May 6, 2024 18:10
Copy link
Contributor

@odersky odersky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure what the changes in the CB build files are for. The changes in config LGTM.

@noti0na1
Copy link
Member Author

noti0na1 commented May 7, 2024

I am not sure what the changes in the CB build files are for.

@odersky Since this change will reject invalid language features, I just delete old flags (like higherKind from Scala 2) in CB.

@noti0na1 noti0na1 force-pushed the enhance-language-flag-help branch from ef08237 to b2b7f10 Compare May 13, 2024 15:33
@noti0na1 noti0na1 force-pushed the enhance-language-flag-help branch from b2b7f10 to b7fc5da Compare May 14, 2024 12:08
@noti0na1 noti0na1 merged commit 7c9aae3 into scala:main May 14, 2024
19 checks passed
@noti0na1 noti0na1 deleted the enhance-language-flag-help branch May 14, 2024 17:52
@WojciechMazur
Copy link
Contributor

I wonder would it be possible to make the unknown -language options yield warning instead of error. This way it would be more alligned with handling of other unknown scalac options - these are ignored are yield warning. I've found it quite annoying when reproducing OpenCB failures when projects use plugins to set common scalacOptions - these typically might contain deprecated or removed in Scala 3 scalac options.
#20419

@Kordyjan Kordyjan added this to the 3.5.1 milestone Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Scala3 -language compiler option issues
5 participants