- Notifications
You must be signed in to change notification settings - Fork 148
Description
Sorry for another ticket like #2779 / #753... I understand there are difficulties how to handle this, but the user experience can probably still be improved.
There are compiler options not forwarded by the compiler, for example
➜ sandbox scala-cli compile --server=false C.scala -- [E007] Type Mismatch Error: /Users/luc/code/scala/scala13/sandbox/C.scala:2:15 ... | longer explanation available when compiling with `-explain` 1 error found Compilation failed ➜ sandbox scala-cli compile --server=false C.scala -explain Unrecognized argument: -explain To list all available options, run scala-cli compile --help
When a user installs Scala, runs the compiler, and the compiler tells them to add a flag (-explain
), they should not need to figure out that they actually need to do -O -explain
.
The approach currently is for scala-cli to forward known compiler flags. Would it be possible to pass all unrecognized arguments to the compiler by default (for compile / repl / doc)?
As a backstop, a static hint in the "Unrecognized argument" message could help. If scala-cli compile / repl / doc
gets an unrecognized argument, it could suggest "Use -O ${unrecognized} to pass the argument to the Scala compiler"
.
Another confusing situation is because the compiler is not invoked when there are no souce files. So scala-cli compile -S 2 C.scala -opt:help
works, but scala-cli compile -S 2 -opt:help
doesn't.
Finally, in Scala 2 at least there are compiler options that support space separated arguments, for example -Vopt _
or -Vprint-args args.txt
. The first makes scala-cli hang, the second gives an error message ([error] args.txt: unrecognized source type
).
It's again not obvious for the user what's going on.