scalacenter / bloop

Bloop is a build server and CLI tool to compile, test and run Scala fast from any editor or build tool.
https://scalacenter.github.io/bloop/
Apache License 2.0
906 stars 201 forks source link

AssertionError when compiling #2344

Closed gruggiero closed 5 months ago

gruggiero commented 5 months ago

When using metals to compile a modified Pekko persistence project I get the following error, both in VSCode and in Emacs:

error id: NSyYGUc5DnwKkQucZsut4Q==
### Bloop error:

Unexpected error when compiling pekko-persistence-dynamodb: java.lang.AssertionError: assertion failed: asTerm called on not-a-Term val <none>
    at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
    at dotty.tools.dotc.core.Symbols$Symbol.asTerm(Symbols.scala:182)
    at dotty.tools.dotc.core.Definitions.ObjectClass(Definitions.scala:324)
    at dotty.tools.dotc.core.Definitions.ObjectType(Definitions.scala:328)
    at dotty.tools.dotc.core.Definitions.AnyRefAlias(Definitions.scala:427)
    at dotty.tools.dotc.core.Definitions.syntheticScalaClasses(Definitions.scala:2133)
    at dotty.tools.dotc.core.Definitions.syntheticCoreClasses(Definitions.scala:2145)
    at dotty.tools.dotc.core.Definitions.init(Definitions.scala:2161)
    at dotty.tools.dotc.core.Contexts$ContextBase.initialize(Contexts.scala:899)
    at dotty.tools.dotc.core.Contexts$Context.initialize(Contexts.scala:523)
    at dotty.tools.dotc.Run.rootContext(Run.scala:464)
    at dotty.tools.dotc.Run.<init>(Run.scala:485)
    at dotty.tools.dotc.Compiler.newRun(Compiler.scala:174)
    at dotty.tools.dotc.Driver.doCompile(Driver.scala:35)
    at dotty.tools.xsbt.CompilerBridgeDriver.run(CompilerBridgeDriver.java:141)
    at dotty.tools.xsbt.CompilerBridge.run(CompilerBridge.java:22)
    at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:91)
    at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.compileSources$1(BloopHighLevelCompiler.scala:133)
    at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.$anonfun$compile$7(BloopHighLevelCompiler.scala:159)
    at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
    at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.$anonfun$compile$1(BloopHighLevelCompiler.scala:71)
    at bloop.tracing.NoopTracer$.trace(BraveTracer.scala:53)
    at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.timed$1(BloopHighLevelCompiler.scala:70)
    at sbt.internal.inc.bloop.internal.BloopHighLevelCompiler.$anonfun$compile$6(BloopHighLevelCompiler.scala:159)
    at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
    at monix.eval.internal.TaskRunLoop$.startFull(TaskRunLoop.scala:81)
    at monix.eval.internal.TaskRestartCallback.syncOnSuccess(TaskRestartCallback.scala:101)
    at monix.eval.internal.TaskRestartCallback.onSuccess(TaskRestartCallback.scala:74)
    at monix.eval.internal.TaskExecuteOn$AsyncRegister$$anon$1.run(TaskExecuteOn.scala:71)
    at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1423)
    at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387)
    at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1312)
    at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1843)
    at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1808)
    at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188)

I get the same error when using Bloop from command line. The project compiles fine in sbt without errors.

Bloop v1.5.17 Scala 3.4.2 sbt 1.10.0 openjdk 21.0.3 Ubuntu 22.04.4 LTS

Let me know if other details are needed.

Thank you

tgodzik commented 5 months ago

Thanks for reporting! Any chance to get the reproduction to test it out?

gruggiero commented 5 months ago

Actually I just had the problem with the main branch pulled from the base repo pekko-persistence-dynamodb

EDIT: Removing the old .bloop file and reimporting the project solved the issue. I don't know what caused the .bloop "corruption". Sorry for the misleading report. Let me know if you want more details in case this happens again.