Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

varargs in main causes errors #1391

Open
tcmulcahy opened this issue Dec 5, 2023 · 0 comments
Open

varargs in main causes errors #1391

tcmulcahy opened this issue Dec 5, 2023 · 0 comments

Comments

@tcmulcahy
Copy link

I'm running Ammonite on Mac Ventura 13.4, Ammonite version:

$ amm --version
Ammonite REPL & Script-Runner, 2.5.11

Ammonite was installed via homebrew.

I'm able to use Ammonite just fine, until I try to use varargs in my main function (like documented here: https://ammonite.io/#ScriptArguments). Here's my minimal repro

$ cat /tmp/test
#!/usr/bin/env amm
// vi: filetype=scala

@main
def entrypoint(args: String*) = {
}

And here's the errors I get:

$ /tmp/test
Compiling /tmp/test
exception caught when loading class $: java.lang.AssertionError: assertion failed
-- Warning: /tmp/test:3:24 -----------------------------------------------------
3 |package $file.^.^.^.^.^.^.tmp
  |                        ^
  |The package name `^` will be encoded on the classpath, and can lead to undefined behaviour.
-- Warning: /tmp/test:3:22 -----------------------------------------------------
3 |package $file.^.^.^.^.^.^.tmp
  |                      ^
  |The package name `^` will be encoded on the classpath, and can lead to undefined behaviour.
-- Warning: /tmp/test:3:20 -----------------------------------------------------
3 |package $file.^.^.^.^.^.^.tmp
  |                    ^
  |The package name `^` will be encoded on the classpath, and can lead to undefined behaviour.
-- Warning: /tmp/test:3:18 -----------------------------------------------------
3 |package $file.^.^.^.^.^.^.tmp
  |                  ^
  |The package name `^` will be encoded on the classpath, and can lead to undefined behaviour.
-- Warning: /tmp/test:3:16 -----------------------------------------------------
3 |package $file.^.^.^.^.^.^.tmp
  |                ^
  |The package name `^` will be encoded on the classpath, and can lead to undefined behaviour.
-- Warning: /tmp/test:3:14 -----------------------------------------------------
3 |package $file.^.^.^.^.^.^.tmp
  |              ^
  |The package name `^` will be encoded on the classpath, and can lead to undefined behaviour.
-- [E007] Type Mismatch Error: /tmp/test:58:60 ---------------------------------
 58 |  def apply() = mainargs.ParserForMethods[$routesOuter.type]($routesOuter)
    |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |                Found:    Seq[String]
    |                Required: String
    |---------------------------------------------------------------------------
    |Inline stack trace
    |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    |This location contains code that was inlined from Macros.scala:120
    |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    |This location contains code that was inlined from Macros.scala:120
     ---------------------------------------------------------------------------
    |
    | longer explanation available when compiling with `-explain`
Compilation Failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant