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 failed: position not set for dotty.tools.dotc.core.Decorators.className(<empty>) in dotty #7038

Open
KacperFKorban opened this issue Dec 17, 2024 · 1 comment
Labels
bug Something that is making a piece of functionality unusable presentation-compiler Something relating to the presentation compiler Scala 3 Generic ticket relating to Scala 3 upstream-fix-needed Waiting on a fix upstream

Comments

@KacperFKorban
Copy link
Collaborator

  1. In scala/scala3 repo go to Applications.scala and method tryAdaptPatternArgs.

  2. Modify the method tryAdaptPatternArgs by adding the first line of the body, as follows:

private def tryAdaptPatternArgs(elems: List[untpd.Tree], pt: Type)(using Context): Option[List[untpd.Tree]] =
      if elems.exists(_.@@)
      tryEither[Option[List[untpd.Tree]]]
        (Some(desugar.adaptPatternArgs(elems, pt)))
        ((_, _) => None)
  1. Ask for a completion on the position marked by @@

Error stacktrace:

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)
	dotty.tools.dotc.interactive.Completion$Completer.$anonfun$23(Completion.scala:604)
	scala.collection.immutable.List.flatMap(List.scala:294)
	scala.collection.immutable.List.flatMap(List.scala:79)
	dotty.tools.dotc.interactive.Completion$Completer.extensionCompletions(Completion.scala:601)
	dotty.tools.dotc.interactive.Completion$Completer.selectionCompletions(Completion.scala:449)
	dotty.tools.dotc.interactive.Completion$.computeCompletions(Completion.scala:221)
	dotty.tools.dotc.interactive.Completion$.rawCompletions(Completion.scala:80)
	dotty.tools.pc.completions.Completions.enrichedCompilerCompletions(Completions.scala:114)
	dotty.tools.pc.completions.Completions.completions(Completions.scala:136)
	dotty.tools.pc.completions.CompletionProvider.completions(CompletionProvider.scala:135)
	dotty.tools.pc.ScalaPresentationCompiler.complete$$anonfun$1(ScalaPresentationCompiler.scala:150)

Short summary:

java.lang.AssertionError: assertion failed: position not set for dotty.tools.dotc.core.Decorators.className(<empty>) # -1 of class dotty.tools.dotc.ast.Trees$Apply in <WORKSPACE>/compiler/src/dotty/tools/dotc/typer/Applications.scala

Expected behaviour:

Should get a non-empty completion from metals.

Operating system:
Linux

Java version:
17.0.13

Editor/extension:
Visual Studio Code v1.95.3

Metals version:
1.4.1

Extra context or search terms:

scala3, completion, dotty

Workspace information:

  • Scala versions: 3.6.0; 2.12.20; 2.13.15
  • Build tools: 0. sbt
  • Build servers:
    0. sbt v1.10.5
  • All build tools in workspace: sbt
@tgodzik
Copy link
Contributor

tgodzik commented Dec 18, 2024

Thanks for reporting! Looks like na issue related to scala/scala3#22217

@tgodzik tgodzik added bug Something that is making a piece of functionality unusable Scala 3 Generic ticket relating to Scala 3 presentation-compiler Something relating to the presentation compiler upstream-fix-needed Waiting on a fix upstream labels Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that is making a piece of functionality unusable presentation-compiler Something relating to the presentation compiler Scala 3 Generic ticket relating to Scala 3 upstream-fix-needed Waiting on a fix upstream
Projects
Status: Triage
Development

No branches or pull requests

2 participants