Open
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
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
Gedochao commentedon Dec 16, 2024
cc @tgodzik @kasiaMarek
tgodzik commentedon Dec 16, 2024
Would that just be a case of adding a try?
rochala commentedon Dec 16, 2024
In multiple places, yes. I've discussed this with @kasiaMarek, and it may be good to create a wrapper used for tracking each completion part + we could use this to report timings to find bottlenecks.
But overall it should be a multiple try catch clauses, ideally in every completion step so only one "Contributor" fails a time.
fix: Only fallback to the definition of a synthetic valdef if it is z…
fix: Only fallback to the definition of a synthetic valdef if it is z…