Skip to content

Commit 926905d

Browse files
committed
Handle patterns at all levels
1 parent 926ed96 commit 926905d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ trait QuotesAndSplices {
5353
ctx.error(em"Quotes require stable QuoteContext, but found non stable $qctx", qctx.sourcePos)
5454

5555
val tree1 =
56-
if ctx.mode.is(Mode.Pattern) && level == 0 then
56+
if ctx.mode.is(Mode.Pattern) then
5757
typedQuotePattern(tree, pt, qctx)
5858
else if (tree.quoted.isType)
5959
typedTypeApply(untpd.TypeApply(untpd.ref(defn.InternalQuoted_typeQuote.termRef), tree.quoted :: Nil), pt)(using quoteContext)
@@ -72,7 +72,7 @@ trait QuotesAndSplices {
7272
ctx.warning("Canceled quote directly inside a splice. ${ '{ XYZ } } is equivalent to XYZ.", tree.sourcePos)
7373
case _ =>
7474
}
75-
if (ctx.mode.is(Mode.QuotedPattern) && level == 1)
75+
if (ctx.mode.is(Mode.QuotedPattern))
7676
if (isFullyDefined(pt, ForceDegree.all)) {
7777
def spliceOwner(ctx: Context): Symbol =
7878
if (ctx.mode.is(Mode.QuotedPattern)) spliceOwner(ctx.outer) else ctx.owner

tests/neg/i8052.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ object Macro2 {
1111
def derived[T: Type](ev: Expr[Mirror.Of[T]])(using qctx: QuoteContext): Expr[TC[T]] = '{
1212
new TC[T] {
1313
def encode(): Unit = $ev match {
14-
case '{ $m: Mirror.ProductOf[T] } => ??? // error // error
14+
case '{ $m: Mirror.ProductOf[T] } => ??? // error
1515
}
1616
}
1717
}

0 commit comments

Comments
 (0)