diff --git a/compiler/src/dotty/tools/dotc/interactive/Completion.scala b/compiler/src/dotty/tools/dotc/interactive/Completion.scala index 9d1bb002cabd..c54a81372afa 100644 --- a/compiler/src/dotty/tools/dotc/interactive/Completion.scala +++ b/compiler/src/dotty/tools/dotc/interactive/Completion.scala @@ -587,8 +587,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 84ee3129b0ea..13f373f068c4 100644 --- a/presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionSuite.scala +++ b/presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionSuite.scala @@ -2228,3 +2228,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" + )