@@ -54,9 +54,6 @@ class QuoteContextImpl private (ctx: Context) extends QuoteContext:
54
54
55
55
def rootContext : Context = ctx
56
56
57
- def rootPosition : dotc.util.SourcePosition =
58
- MacroExpansion .position.getOrElse(dotc.util.SourcePosition (rootContext.source, dotc.util.Spans .NoSpan ))
59
-
60
57
type Context = dotc.core.Contexts .Context
61
58
62
59
type Tree = tpd.Tree
@@ -2185,7 +2182,7 @@ class QuoteContextImpl private (ctx: Context) extends QuoteContext:
2185
2182
2186
2183
object Implicits extends ImplicitsModule :
2187
2184
def search (tpe : TypeRepr ): ImplicitSearchResult =
2188
- ctx.typer.inferImplicitArg(tpe, rootPosition .span)
2185
+ ctx.typer.inferImplicitArg(tpe, Position .ofMacroExpansion .span)
2189
2186
end Implicits
2190
2187
2191
2188
type ImplicitSearchResult = Tree
@@ -2544,7 +2541,10 @@ class QuoteContextImpl private (ctx: Context) extends QuoteContext:
2544
2541
2545
2542
type Position = dotc.util.SourcePosition
2546
2543
2547
- object Position extends PositionModule
2544
+ object Position extends PositionModule :
2545
+ def ofMacroExpansion : dotc.util.SourcePosition =
2546
+ MacroExpansion .position.getOrElse(dotc.util.SourcePosition (rootContext.source, dotc.util.Spans .NoSpan ))
2547
+ end Position
2548
2548
2549
2549
object PositionMethodsImpl extends PositionMethods :
2550
2550
extension (self : Position ):
@@ -2616,7 +2616,7 @@ class QuoteContextImpl private (ctx: Context) extends QuoteContext:
2616
2616
if tree.isEmpty then None else Some (tree)
2617
2617
2618
2618
private def withDefaultPos [T <: Tree ](fn : Context ?=> T ): T =
2619
- fn(using ctx.withSource(rootPosition. source)).withSpan(rootPosition .span)
2619
+ fn(using ctx.withSource(Position .ofMacroExpansion. source)).withSpan(Position .ofMacroExpansion .span)
2620
2620
2621
2621
def unpickleTerm (pickledQuote : PickledQuote ): Term =
2622
2622
PickledQuotes .unpickleTerm(pickledQuote)
0 commit comments