Skip to content

Commit 0b072d6

Browse files
committed
Do not make pattern quotes inlinable
1 parent fd34d99 commit 0b072d6

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,17 @@ trait QuotesAndSplices {
5656
else if !qctx.tpe.isStable then
5757
report.error(em"Quotes require stable Quotes, but found non stable $qctx", qctx.srcPos)
5858

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))
7070
}
7171

7272
private def makeInlineable(tree: Tree)(using Context): Tree =

0 commit comments

Comments
 (0)