@@ -45,10 +45,16 @@ trait QuotesAndSplices {
4545 ctx.warning(" Canceled splice directly inside a quote. '[ ${ XYZ } ] is equivalent to XYZ." , tree.sourcePos)
4646 case _ =>
4747 }
48+ val qctx = inferImplicitArg(defn.QuoteContextClass .typeRef, tree.span)
49+ if (level == 0 && qctx.tpe.isInstanceOf [SearchFailureType ])
50+ ctx.error(missingArgMsg(qctx, defn.QuoteContextClass .typeRef, " " ), ctx.source.atSpan(tree.span))
4851 val tree1 =
49- if (ctx.mode.is(Mode .Pattern ) && level == 0 ) typedQuotePattern(tree, pt)
50- else if (tree.quoted.isType) typedTypeApply(untpd.TypeApply (untpd.ref(defn.InternalQuoted_typeQuote .termRef), tree.quoted :: Nil ), pt)(quoteContext)
51- else typedApply(untpd.Apply (untpd.ref(defn.InternalQuoted_exprQuote .termRef), tree.quoted), pt)(quoteContext)
52+ if ctx.mode.is(Mode .Pattern ) && level == 0 then
53+ typedQuotePattern(tree, pt, qctx)
54+ else if (tree.quoted.isType)
55+ typedTypeApply(untpd.TypeApply (untpd.ref(defn.InternalQuoted_typeQuote .termRef), tree.quoted :: Nil ), pt)(quoteContext)
56+ else
57+ typedApply(untpd.Apply (untpd.ref(defn.InternalQuoted_exprQuote .termRef), tree.quoted), pt)(quoteContext).select(nme.apply).appliedTo(qctx)
5258 tree1.withSpan(tree.span)
5359 }
5460
@@ -326,11 +332,7 @@ trait QuotesAndSplices {
326332 * ) => ...
327333 * ```
328334 */
329- private def typedQuotePattern (tree : untpd.Quote , pt : Type )(implicit ctx : Context ): Tree = {
330- val qctx = inferImplicitArg(defn.QuoteContextClass .typeRef, tree.span)
331- if (level == 0 && qctx.tpe.isInstanceOf [SearchFailureType ])
332- ctx.error(missingArgMsg(qctx, defn.QuoteContextClass .typeRef, " " ), ctx.source.atSpan(tree.span))
333-
335+ private def typedQuotePattern (tree : untpd.Quote , pt : Type , qctx : Tree )(implicit ctx : Context ): Tree = {
334336 val quoted = tree.quoted
335337 val exprPt = pt.baseType(if quoted.isType then defn.QuotedTypeClass else defn.QuotedExprClass )
336338 val quotedPt = exprPt.argInfos.headOption match {
0 commit comments