@@ -56,21 +56,23 @@ trait QuotesAndSplices {
56
56
else if ! qctx.tpe.isStable then
57
57
report.error(em " Quotes require stable Quotes, but found non stable $qctx" , qctx.srcPos)
58
58
59
- val tree1 =
60
- if ctx.mode.is( Mode . Pattern ) then
61
- typedQuotePattern( tree, pt, qctx)
62
- else if tree .quoted.isType then
63
- val msg = em " Consider using canonical type constructor scala.quoted.Type.of[ ${ tree.quoted} ] instead "
64
- if sourceVersion.isAtLeast(`future-migration`) then report.error (msg, tree.srcPos)
65
- else report.warning(msg , tree.srcPos )
66
- typedTypeApply(untpd. TypeApply (untpd.ref(defn. QuotedTypeModule_of .termRef), tree.quoted :: Nil ), pt)(using quoteContext).select(nme.apply).appliedTo(qctx)
67
- else
68
- typedApply( untpd.Apply (untpd.ref(defn.QuotedRuntime_exprQuote .termRef), tree.quoted), pt)( using pushQuotes(qctx)).select(nme.apply).appliedTo(qctx )
69
- makeInlineable(tree1 .withSpan(tree.span))
59
+ if ctx.mode.is( Mode . Pattern ) then
60
+ typedQuotePattern(tree, pt, qctx).withSpan(tree.span)
61
+ else if tree.quoted.isType then
62
+ val msg = em " Consider using canonical type constructor scala .quoted.Type.of[ ${tree.quoted} ] instead "
63
+ if sourceVersion.isAtLeast(`future-migration`) then report.error( msg, tree.srcPos)
64
+ else report.warning (msg, tree.srcPos)
65
+ val typeOfTree = untpd. TypeApply (untpd.ref(defn. QuotedTypeModule_of .termRef) , tree.quoted :: Nil ).withSpan(tree.span )
66
+ makeInlineable( typedTypeApply(typeOfTree, pt)(using quoteContext).select(nme.apply).appliedTo(qctx).withSpan(tree.span) )
67
+ else
68
+ val exprQuoteTree = untpd.Apply (untpd.ref(defn.QuotedRuntime_exprQuote .termRef), tree.quoted)
69
+ makeInlineable(typedApply(exprQuoteTree, pt)( using pushQuotes(qctx)).select(nme.apply).appliedTo(qctx) .withSpan(tree.span))
70
70
}
71
71
72
72
private def makeInlineable (tree : Tree )(using Context ): Tree =
73
- PrepareInlineable .makeInlineable(tree)
73
+ inContext(ctx.withOwner(ctx.owner.skipLocalOwners)) {
74
+ PrepareInlineable .makeInlineable(tree)
75
+ }
74
76
75
77
/** Translate `${ t: Expr[T] }` into expression `t.splice` while tracking the quotation level in the context */
76
78
def typedSplice (tree : untpd.Splice , pt : Type )(using Context ): Tree = {
0 commit comments