From b34bdca9943ca1fc23f3b8415a620ebcf5f1c4ce Mon Sep 17 00:00:00 2001 From: rochala Date: Mon, 28 Jul 2025 21:54:02 +0200 Subject: [PATCH] Fix completions for Quotes --- .../dotty/tools/dotc/interactive/Completion.scala | 5 +++-- .../tools/pc/tests/completion/CompletionSuite.scala | 13 +++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/interactive/Completion.scala b/compiler/src/dotty/tools/dotc/interactive/Completion.scala index dc683aabe1e6..3d1c595877df 100644 --- a/compiler/src/dotty/tools/dotc/interactive/Completion.scala +++ b/compiler/src/dotty/tools/dotc/interactive/Completion.scala @@ -615,8 +615,9 @@ object Completion: // 1. The extension method is visible under a simple name, by being defined or inherited or imported in a scope enclosing the reference. val extMethodsInScope = scopeCompletions.names.toList.flatMap: - case (name, denots) => denots.collect: - case d: SymDenotation if d.isTerm && d.termRef.symbol.is(Extension) => (d.termRef, name.asTermName) + case (name, denots) => + denots.collect: + case d if d.isTerm && d.symbol.is(Extension) => (d.symbol.termRef, name.asTermName) // 2. The extension method is a member of some given instance that is visible at the point of the reference. val givensInScope = ctx.implicits.eligible(defn.AnyType).map(_.implicitRef.underlyingRef) diff --git a/presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionSuite.scala b/presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionSuite.scala index 9364c00fa855..05037cffca94 100644 --- a/presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionSuite.scala +++ b/presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionSuite.scala @@ -2275,3 +2275,16 @@ class CompletionSuite extends BaseCompletionSuite: |""".stripMargin, "test: Int" ) + + @Test def `macros` = + check( + """ + |object Macro: + | import scala.quoted.* + | def dbgImpl[A](a: Expr[A])(using Quotes): Expr[A] = + | import quotes.reflect.* + | a.asTer@@ + | + |""".stripMargin, + "asTerm: Term" + )