Skip to content

Commit 926beec

Browse files
authored
Merge pull request #537 from scala/backport-lts-3.3-23619
Backport "Fix completions for Quotes" to 3.3 LTS
2 parents d673d5d + d491de0 commit 926beec

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

compiler/src/dotty/tools/dotc/interactive/Completion.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -587,8 +587,9 @@ object Completion:
587587

588588
// 1. The extension method is visible under a simple name, by being defined or inherited or imported in a scope enclosing the reference.
589589
val extMethodsInScope = scopeCompletions.names.toList.flatMap:
590-
case (name, denots) => denots.collect:
591-
case d: SymDenotation if d.isTerm && d.termRef.symbol.is(Extension) => (d.termRef, name.asTermName)
590+
case (name, denots) =>
591+
denots.collect:
592+
case d if d.isTerm && d.symbol.is(Extension) => (d.symbol.termRef, name.asTermName)
592593

593594
// 2. The extension method is a member of some given instance that is visible at the point of the reference.
594595
val givensInScope = ctx.implicits.eligible(defn.AnyType).map(_.implicitRef.underlyingRef)

presentation-compiler/test/dotty/tools/pc/tests/completion/CompletionSuite.scala

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2228,3 +2228,16 @@ class CompletionSuite extends BaseCompletionSuite:
22282228
|""".stripMargin,
22292229
"test: Int"
22302230
)
2231+
2232+
@Test def `macros` =
2233+
check(
2234+
"""
2235+
|object Macro:
2236+
| import scala.quoted.*
2237+
| def dbgImpl[A](a: Expr[A])(using Quotes): Expr[A] =
2238+
| import quotes.reflect.*
2239+
| a.asTer@@
2240+
|
2241+
|""".stripMargin,
2242+
"asTerm: Term"
2243+
)

0 commit comments

Comments
 (0)