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

Assertion being thrown in a normal compilation #21947

Open
tgodzik opened this issue Nov 14, 2024 · 1 comment
Open

Assertion being thrown in a normal compilation #21947

tgodzik opened this issue Nov 14, 2024 · 1 comment

Comments

@tgodzik
Copy link
Contributor

tgodzik commented Nov 14, 2024

Compiler version

3.5.0 (though this probably also happens on latest)

Minimized code

It can probably happen in any code, but it needs to compile from Metals and from Scala CLI at the same time.

println("hello, world")

Though, the thing is that we don't compile anything simultaneously, so it's pretty weird to happen. This might actually be some incremental compilation issue.

Output

Error compiling project (Scala 3.5.0, JVM (17))
Error: Unexpected error when compiling aoc-scala_bde03bda35-5224438d5a: 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:186)
        at dotty.tools.dotc.core.Definitions.ObjectClass(Definitions.scala:325)
        at dotty.tools.dotc.core.Definitions.ObjectType(Definitions.scala:329)
        at dotty.tools.dotc.core.Definitions.AnyRefAlias(Definitions.scala:428)
        at dotty.tools.dotc.core.Definitions.syntheticScalaClasses(Definitions.scala:2163)
        at dotty.tools.dotc.core.Definitions.syntheticCoreClasses(Definitions.scala:2176)
        at dotty.tools.dotc.core.Definitions.init(Definitions.scala:2192)
        at dotty.tools.dotc.core.Contexts$ContextBase.initialize(Contexts.scala:921)
        at dotty.tools.dotc.core.Contexts$Context.initialize(Contexts.scala:544)
        at dotty.tools.dotc.Run.rootContext(Run.scala:503)
        at dotty.tools.dotc.Run.<init>(Run.scala:524)
        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.compute(ForkJoinTask.java:1726)
        at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.compute(ForkJoinTask.java:1717)
        at java.base/java.util.concurrent.ForkJoinTask$InterruptibleTask.exec(ForkJoinTask.java:1641)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:507)
        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1489)
        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:2071)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:2033)
        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:187)

Judging by the stack trace, could this be a similar issue as scala/bug#13045 ?

Expectation

The compiler should provide more information about what is going on, having an assertion thrown here doesn't give us a lot of information.

@Gedochao
Copy link
Contributor

Note: tagged it as stat:cannot reproduce, as we do not have a reliable method of reproduction, but we've seen this being reported for a long while.
Some investigation around the assertion check independently would perhaps be useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants