Skip to content

give some error message when using bad directive #1636

@bjornregnell

Description

@bjornregnell

Version(s)
0.1.18

Describe the bug
scala-cli should complain if I write bad directives like by mistake replacing using with use after //>

To Reproduce

$ cat main.scala 
//> use scala "3.2.1"
//> use lib "org.jline:jline:3.21.0"

val t = org.jline.terminal.TerminalBuilder.terminal

@main def run = 
  println(s"hello $t")

$ scala-cli run main.scala 
Compiling project (Scala 3.2.1, JVM)
[error] ./main.scala:4:9: value jline is not a member of org
[error] val t = org.jline.terminal.TerminalBuilder.terminal
[error]         ^^^^^^^^^
Error compiling project (Scala 3.2.1, JVM)
Compilation failed

Above nothing is said about that the directive is bad. Instead it goes ahead and compiles and the compile error is not so helpful...

Expected behaviour
I should get some feedback that use is not a valid directive; it would be nice if it proposed something like did you mean 'using' .

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions