com-lihaoyi / Ammonite

Scala Scripting
http://ammonite.io
MIT License
2.61k stars 368 forks source link

Scala 3: Importing circe-core breaks further evaluation due to `export` identifier #1487

Closed coreyoconnor closed 4 months ago

coreyoconnor commented 4 months ago

The following session demonstrates a failure when re-evaluating an import of io.circe.* in a Scala 3 session:

[~]$ cs launch ammonite --scala 3
Loading...
Welcome to the Ammonite Repl 3.0.0-M1-19-a7973e17 (Scala 3.3.3 Java 19.0.2)
@ import $ivy.`io.circe::circe-core:0.14.6` 
import $ivy.$                            

@ import io.circe.* 
import io.circe.*

@ {
  import io.circe.*
  println("ASD")
  } 
-- [E040] Syntax Error: cmd2.sc:52:2 -------------------------------------------
52 |  export,
   |  ^^^^^^
   |  an identifier expected, but 'export' found
   |
   | longer explanation available when compiling with `-explain`
Compilation Failed
coreyoconnor commented 4 months ago

The same session using scala 2.13 works as expected:

[~]$ cs launch ammonite --scala 2
Loading...
Welcome to the Ammonite Repl 3.0.0-M1-24-26133e66 (Scala 2.13.14 Java 19.0.2)
@ import $ivy.`io.circe::circe-core:0.14.6` 
import $ivy.$

@ import io.circe._ 
import io.circe._

@ {
  import io.circe._
  println("ASD")
  } 
ASD
import io.circe._

@