scala-cli
scala-cli copied to clipboard
unclosed string literals in `//> using` causes unhelpful error message: `Error: java.lang.NullPointerException`
Version(s)
0.1.3
Describe the bug
Parsing unclosed string literals in //> using comments crashes with a very unhelpful Error: java.lang.NullPointerException
Can have a partial string or not, does not matter.
To Reproduce
put the following in test.scala and run scala-cli test.scala
//> using lib "
Expected behaviour
An error message that points to an incorrect //> using or at least to some form of syntax error at all.
I ran into this issue as well.
//> using platform "jvm"
//> using scala "2.13.8"
//> using resourceDir "./resources
object Example extends App{
def main(args: List[String]): Unit = println("Running Main")
}
scala-cli run Example.scala
Error: java.lang.NullPointerException
For more details, please see '/......./stacktraces/1653704614-14259486525061593819.log'
If you run with --verbose, the error also changes.
scala-cli run --verbose Example.scala ✘ 1
Error: java.lang.NoSuchMethodError: com.github.plokhotnyuk.jsoniter_scala.core.JsonValueCodec.encodeValue$mcI$sp(int, com.github.plokhotnyuk.jsoniter_scala.core.JsonWriter)
For more details, please see '/......./stacktraces/1653705139-15744627353042436274.log'
Just hit this :)
//> using scala "2.13.10
object demo extends App {
println("a")
}
scala-cli since at least version 0.1.20 outputs:
❯ scala-cli run test.scala
[error] ./test.scala:1:15: unclosed string literal
[error] //> using lib "
[error] ^
which seems to be good enough to me!
yep, shows up in metals too!