Ammonite icon indicating copy to clipboard operation
Ammonite copied to clipboard

error while loading `CompilerExtensions$`

Open avdv opened this issue 3 years ago • 3 comments

Hi.

Running ammonite under Linux gives me:

$ ./amm 
Loading...
Welcome to the Ammonite Repl 2.4.0 (Scala 3.0.0 Java 11.0.10)
@ error while loading CompilerExtensions$,
amm/compiler/src/main/scala-3/ammonite/compiler/CompilerExtensions.scala: Not a directory
@ 1 + 2 
   |  CompilerInterpAPIExtensions,
   |  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |value CompilerInterpAPIExtensions is not a member of object ammonite.compiler.CompilerExtensions
   |  CompilerReplAPIExtensions
   |  ^^^^^^^^^^^^^^^^^^^^^^^^^
   |value CompilerReplAPIExtensions is not a member of object ammonite.compiler.CompilerExtensions
   |import _root_.ammonite.compiler.CompilerExtensions.{
   |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |   constructor proxy object CompilerExtensions cannot be used as a value
Compilation Failed

How can I debug this? Where does it expect to find the CompilerExtensions.scala file?

BTW, this seems to be specific to the Scala 3 launcher, 2.4.0-2.13 works just fine:

$ ./amm213 
Loading...
Welcome to the Ammonite Repl 2.4.0 (Scala 2.13.6 Java 11.0.10)
@ 1 + 2 
res0: Int = 3

avdv avatar Jun 29 '21 08:06 avdv

I receive this same error on a MBP M1. Please let me know if I should create a separate issue given my OS and such is different :)

ammonite version == 2.4.0

masonedmison avatar Jul 06 '21 02:07 masonedmison

Same error using 2.5.2 with scala 3 under Linux, here are some observations:

  1. the loading path from error message is the path of ammonite source code, not package/classname and asking for directory, not file: amm/compiler/src/main/scala-3/ammonite/compiler/CompilerExtensions.scala: Not a directory
  2. Disable the default predef seems make REPL works ./amm3 --no-default-predef
  3. this error seems only occurs when ammonite invoked under home directory, so
    1. ~/amm3 has error if pwd is ~, no error if pwd is elsewhere
    2. similarly, ~/tmp/amm3 has error if pwd is ~, no error if pwd is elsewhere

chikei avatar Mar 09 '22 08:03 chikei

this error seems only occurs when ammonite invoked under home directory, so

1. `~/amm3` has error if pwd is `~`, no error if pwd is elsewhere

2. similarly, `~/tmp/amm3` has error if pwd is `~`, no error if pwd is elsewhere

That is an interesting observation, @chikei !

This really seems to happen only when the script is called amm and is located in the current directory:

$ ./amm
Loading...
Welcome to the Ammonite Repl 2.5.2 (Scala 3.1.1 Java 11.0.12)
@ error while loading CompilerExtensions$,
amm/compiler/src/main/scala-3/ammonite/compiler/CompilerExtensions.scala: Not a directory
Bye!

$ mv amm foobar

$ ./foobar 
Loading...
Welcome to the Ammonite Repl 2.5.2 (Scala 3.1.1 Java 11.0.12)
@ 1  +1 
res0: Int = 2

@ Bye!

Still, this seems some kind of regression in comparison to the Scala 2.13 REPL which just works in this case.

avdv avatar Mar 09 '22 15:03 avdv