Skip to content

Commit 65b92a3

Browse files
authored
Merge pull request #8727 from dotty-staging/fix-quote-pattern-assign
Quote pattern cleanups
2 parents c811957 + 39529db commit 65b92a3

File tree

1 file changed

+5
-16
lines changed

1 file changed

+5
-16
lines changed

library/src/scala/internal/quoted/Matcher.scala

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ import scala.quoted._
6767
* '{ while e0 do e1 } =?= '{ while p0 do p1 } ===> '{e0} =?= '{p0} &&& '{e1} =?= '{p1}
6868
*
6969
* /* Match assign */
70-
* '{ e0 = e1 } =?= '{ p0 = p1 } && '{e0} =?= '{p0} ===> '{e1} =?= '{p1}
70+
* '{ e0 = e1 } =?= '{ p0 = p1 } ==> '{e0} =?= '{p0} &&& '{e1} =?= '{p1}
7171
*
7272
* /* Match new */
7373
* '{ new T } =?= '{ new T } ===> matched
@@ -316,22 +316,15 @@ private[quoted] object Matcher {
316316
qual1 =?= qual2
317317

318318
/* Match reference */
319-
// TODO could be subsumed by the next case
320-
case (Ident(_), Ident(_)) if scrutinee.symbol == pattern.symbol || summon[Env].get(scrutinee.symbol).contains(pattern.symbol) =>
321-
matched
322-
323-
/* Match reference */
324-
case (_: Ref, _: Ref) if scrutinee.symbol == pattern.symbol =>
319+
case (_: Ref, _: Ref) if scrutinee.symbol == pattern.symbol || summon[Env].get(scrutinee.symbol).contains(pattern.symbol) =>
325320
matched
326321

327322
/* Match application */
328-
// TODO may not need to check the symbol (done in fn1 =?= fn2)
329-
case (Apply(fn1, args1), Apply(fn2, args2)) if fn1.symbol == fn2.symbol || summon[Env].get(fn1.symbol).contains(fn2.symbol) =>
323+
case (Apply(fn1, args1), Apply(fn2, args2)) =>
330324
fn1 =?= fn2 &&& args1 =?= args2
331325

332326
/* Match type application */
333-
// TODO may not need to check the symbol (done in fn1 =?= fn2)
334-
case (TypeApply(fn1, args1), TypeApply(fn2, args2)) if fn1.symbol == fn2.symbol || summon[Env].get(fn1.symbol).contains(fn2.symbol) =>
327+
case (TypeApply(fn1, args1), TypeApply(fn2, args2)) =>
335328
fn1 =?= fn2 &&& args1 =?= args2
336329

337330
case (Block(stats1, expr1), Block(binding :: stats2, expr2)) if isTypeBinding(binding) =>
@@ -365,11 +358,7 @@ private[quoted] object Matcher {
365358

366359
/* Match assign */
367360
case (Assign(lhs1, rhs1), Assign(lhs2, rhs2)) =>
368-
val lhsMatch =
369-
if ((lhs1 =?= lhs2).isMatch) matched
370-
else notMatched
371-
// TODO lhs1 =?= lhs2 &&& rhs1 =?= rhs2
372-
lhsMatch &&& rhs1 =?= rhs2
361+
lhs1 =?= lhs2 &&& rhs1 =?= rhs2
373362

374363
/* Match new */
375364
case (New(tpt1), New(tpt2)) if tpt1.tpe.typeSymbol == tpt2.tpe.typeSymbol =>

0 commit comments

Comments
 (0)