Skip to content

asTerm called on not-a-Term val <none> thrown when compiling Dotty via Bloop #2517

@mbovel

Description

@mbovel

I just cloned Dotty (at scala/scala3@c3d6c48) on a new Ubuntu machine and tried to use Bloop as the build server.

Metals seems to work: I can go to symbol, read doc, I have inlay type hints (😍), etc.

However, if I go to compiler/src/dotty/tools/dotc/typer/Typer.scala every time I save, even if I do no changes, scala3-compiler is recompiled entirely (~30 seconds approximately on this fast machine, would take 4 times more on my laptop):

2024.11.26 15:15:07 INFO  compiling scala3-compiler (582 scala sources and 8 java sources)
2024.11.26 15:15:38 WARN  javac exited with exit code 1
2024.11.26 15:15:38 INFO  time: compiled scala3-compiler in 32s
2024.11.26 15:15:47 INFO  compiling scala3-compiler (582 scala sources and 8 java sources)
2024.11.26 15:16:15 WARN  javac exited with exit code 1
2024.11.26 15:16:15 INFO  time: compiled scala3-compiler in 28s
2024.11.26 15:16:17 INFO  compiling scala3-compiler (582 scala sources and 8 java sources)
2024.11.26 15:16:45 WARN  javac exited with exit code 1
2024.11.26 15:16:45 INFO  time: compiled scala3-compiler in 28s
2024.11.26 15:31:49 INFO  compiling scala3-compiler (582 scala sources and 8 java sources)
2024.11.26 15:32:20 WARN  javac exited with exit code 1
2024.11.26 15:32:20 INFO  time: compiled scala3-compiler in 31s
2024.11.26 15:32:50 INFO  compiling scala3-compiler (582 scala sources and 8 java sources)
2024.11.26 15:33:21 WARN  javac exited with exit code 1

Looking further:

  • There are errors reported in compiler/src/dotty/tools/dotc/sbt/interfaces/ProgressCallback.java and dotty/tools/dotc/sbt/interfaces/ProgressCallback.java:

    image
  • Compilation of scala3-compiler fails with a compiler crash: assertion failed: asTerm called on not-a-Term val <none>:

    scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
    dotty.tools.dotc.core.Symbols$Symbol.asTerm(Symbols.scala:186)
    dotty.tools.dotc.ast.tpd$.New(tpd.scala:544)
    dotty.tools.dotc.core.Annotations$Annotation$Child$.makeChildLater$1(Annotations.scala:233)
    dotty.tools.dotc.core.Annotations$Annotation$Child$.later$$anonfun$1(Annotations.scala:236)
    dotty.tools.dotc.core.Annotations$LazyAnnotation.tree(Annotations.scala:142)
    dotty.tools.dotc.core.Annotations$Annotation$Child$.unapply(Annotations.scala:244)
    dotty.tools.dotc.typer.Namer.insertInto$1(Namer.scala:489)
    dotty.tools.dotc.typer.Namer.addChild(Namer.scala:500)
    dotty.tools.dotc.typer.Namer$Completer.register$1(Namer.scala:967)
    dotty.tools.dotc.typer.Namer$Completer.registerIfChildInCreationContext$$anonfun$2(Namer.scala:979)
    scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
    scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
    scala.collection.immutable.List.foreach(List.scala:334)
    dotty.tools.dotc.typer.Namer$Completer.registerIfChildInCreationContext(Namer.scala:979)
    dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:860)
    dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:175)
    dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:190)
    dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:192)
    dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:393)
    dotty.tools.dotc.typer.Typer.retrieveSym(Typer.scala:3426)
    dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3451)
    dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3563)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3641)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3645)
    dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3667)
    dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3713)
    dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:3161)
    dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$1(Typer.scala:3467)
    dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3471)
    dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3563)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3641)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3645)
    dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3667)
    dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3713)
    dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:3161)
    dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$1(Typer.scala:3467)
    dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:3471)
    dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3563)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3641)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3645)
    dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3667)
    dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3713)
    dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:3294)
    dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3513)
    dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3564)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3641)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3645)
    dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3694)
    dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3713)
    dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:3294)
    dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3513)
    dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3564)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3641)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3645)
    dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3694)
    dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3713)
    dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:3294)
    dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3513)
    dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:3564)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3641)
    dotty.tools.dotc.typer.Typer.typed(Typer.scala:3645)
    dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3756)
    dotty.tools.dotc.typer.TyperPhase.typeCheck$$anonfun$1(TyperPhase.scala:47)
    scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
    scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
    dotty.tools.dotc.core.Phases$Phase.monitor(Phases.scala:507)
    dotty.tools.dotc.typer.TyperPhase.typeCheck(TyperPhase.scala:53)
    dotty.tools.dotc.typer.TyperPhase.$anonfun$4(TyperPhase.scala:99)
    scala.collection.Iterator$$anon$6.hasNext(Iterator.scala:479)
    scala.collection.Iterator$$anon$9.hasNext(Iterator.scala:583)
    scala.collection.immutable.List.prependedAll(List.scala:152)
    scala.collection.immutable.List$.from(List.scala:685)
    scala.collection.immutable.List$.from(List.scala:682)
    scala.collection.IterableOps$WithFilter.map(Iterable.scala:900)
    dotty.tools.dotc.typer.TyperPhase.runOn(TyperPhase.scala:98)
    dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:343)
    scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
    scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
    scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1323)
    dotty.tools.dotc.Run.runPhases$1(Run.scala:336)
    dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:384)
    dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:396)
    dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:69)
    dotty.tools.dotc.Run.compileUnits(Run.scala:396)
    dotty.tools.dotc.Run.compileSources(Run.scala:282)
    dotty.tools.dotc.interactive.InteractiveDriver.run(InteractiveDriver.scala:161)
    dotty.tools.pc.CachingDriver.run(CachingDriver.scala:45)
    dotty.tools.pc.PcInlayHintsProvider.<init>(PcInlayHintsProvider.scala:45)
    dotty.tools.pc.ScalaPresentationCompiler.inlayHints$$anonfun$1(ScalaPresentationCompiler.scala:122)
    

Debug files:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions