scala3
scala3 copied to clipboard
Enhance help message for language flag
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
@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)
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.
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. https://github.com/scala/scala3/issues/20419