diff options
author | Som Snytt <som.snytt@gmail.com> | 2014-07-18 00:19:01 -0700 |
---|---|---|
committer | Som Snytt <som.snytt@gmail.com> | 2014-07-18 00:19:01 -0700 |
commit | 68560dd80d99f031bdf419f08463abeb83e47b3c (patch) | |
tree | 73f874bb7fc7d85f098c9d08e9085decad154b76 /src/compiler/scala/tools/nsc/settings/ScalaSettings.scala | |
parent | bde623925d011841f222891050c5fdb08f3bb251 (diff) | |
download | scala-68560dd80d99f031bdf419f08463abeb83e47b3c.tar.gz scala-68560dd80d99f031bdf419f08463abeb83e47b3c.tar.bz2 scala-68560dd80d99f031bdf419f08463abeb83e47b3c.zip |
SI-8525 MultiChoice takes a helper function
Clean-up code review comments.
MultiChoice takes a helper function for outputting help text.
Diffstat (limited to 'src/compiler/scala/tools/nsc/settings/ScalaSettings.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/settings/ScalaSettings.scala | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala index 6675ad96e6..5c3eadbd60 100644 --- a/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala +++ b/src/compiler/scala/tools/nsc/settings/ScalaSettings.scala @@ -70,8 +70,27 @@ trait ScalaSettings extends AbsScalaSettings // Would be nice to build this dynamically from scala.languageFeature. // The two requirements: delay error checking until you have symbols, and let compiler command build option-specific help. val language = { - val features = List("dynamics", "postfixOps", "reflectiveCalls", "implicitConversions", "higherKinds", "existentials", "experimental.macros") - MultiChoiceSetting("-language", "feature", "Enable or disable language features", features) + val features = List( + "dynamics" -> "Allow direct or indirect subclasses of scala.Dynamic", + "postfixOps" -> "Allow postfix operator notation, such as `1 to 10 toList'", + "reflectiveCalls" -> "Allow reflective access to members of structural types", + "implicitConversions" -> "Allow definition of implicit functions called views", + "higherKinds" -> "Allow higher-kinded types", // "Ask Adriaan, but if you have to ask..." + "existentials" -> "Existential types (besides wildcard types) can be written and inferred", + "experimental.macros" -> "Allow macro defintion (besides implementation and application)" + ) + val description = "Enable or disable language features" + MultiChoiceSetting( + name = "-language", + helpArg = "feature", + descr = description, + choices = features map (_._1) + ) { s => + val helpline: ((String, String)) => String = { + case (name, text) => f" $name%-25s $text%n" + } + features map helpline mkString (f"$description:%n", "", f"%n") + } } /* |