Skip to content

Commit 32a927e

Browse files
Synthesise a quote context only for macros
1 parent 0f7a85b commit 32a927e

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

compiler/src/dotty/tools/dotc/core/TypeOps.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,9 @@ trait TypeOps { this: Context => // TODO: Make standalone object.
457457
/** Are we in an inline method body? */
458458
def inInlineMethod: Boolean = owner.ownersIterator.exists(_.isInlineMethod)
459459

460+
/** Are we in a macro? */
461+
def inMacro: Boolean = owner.ownersIterator.exists(s => s.isInlineMethod && s.is(Macro))
462+
460463
/** Is `feature` enabled in class `owner`?
461464
* This is the case if one of the following two alternatives holds:
462465
*

compiler/src/dotty/tools/dotc/typer/Implicits.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ trait Implicits { self: Typer =>
729729

730730
lazy val synthesizedQuoteContext: SpecialHandler =
731731
(formal, span) => implicit ctx =>
732-
if (ctx.inInlineMethod || enclosingInlineds.nonEmpty) ref(defn.QuoteContext_macroContext)
732+
if (ctx.inMacro || enclosingInlineds.nonEmpty) ref(defn.QuoteContext_macroContext)
733733
else EmptyTree
734734

735735
lazy val synthesizedTupleFunction: SpecialHandler =

0 commit comments

Comments
 (0)