-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
area:presentation-compilerRelated to the presentation compiler module used by Metals and possibly other toolsRelated to the presentation compiler module used by Metals and possibly other toolsitype:enhancement
Description
Compiler version
All
Minimized code
Currently, when crash happens during completions calculation, no results are returned.
In my case, the failure happened in
scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
dotty.tools.dotc.typer.Typer$.assertPositioned(Typer.scala:76)
dotty.tools.dotc.typer.Typer.typed(Typer.scala:3636)
dotty.tools.dotc.typer.Applications.extMethodApply(Applications.scala:2630)
dotty.tools.dotc.typer.Applications.extMethodApply$(Applications.scala:434)
dotty.tools.dotc.typer.Typer.extMethodApply(Typer.scala:145)
dotty.tools.dotc.typer.Applications.tryApplyingExtensionMethod(Applications.scala:2675)
dotty.tools.dotc.typer.Applications.tryApplyingExtensionMethod$(Applications.scala:434)
dotty.tools.dotc.typer.Typer.tryApplyingExtensionMethod(Typer.scala:145)
dotty.tools.dotc.interactive.Completion$Completer.tryApplyingReceiverToExtension$1(Completion.scala:561)
The crash was encountered during extension member's completion calculation, and all other results were discarded or not computed. This is not ideal, as sometimes crashes are not related strictly to presentation compiler implementation.
The correct output should be a list of completions without extension members (ideally only those that actually crashed)
Reproduction
I tried completing
List(1, 2, 3).map(_.@@)
With a crash:
java.lang.AssertionError: assertion failed: position not set for dotty.tools.pc.utils.InteractiveEnrichments.companion(<empty>) # -1 of class dotty.tools.dotc.ast.Trees$Apply in <WORKSPACE>/presentation-compiler/src/main/dotty/tools/pc/completions/NamedArgCompletions.scala%
The crash above is not part of this issue, just a fact that presentation compiler should not fail fast.
Metadata
Metadata
Assignees
Labels
area:presentation-compilerRelated to the presentation compiler module used by Metals and possibly other toolsRelated to the presentation compiler module used by Metals and possibly other toolsitype:enhancement