Skip to content

Commit f106e34

Browse files
committed
Fix #8600: Match trough type ascriptions
1 parent 59f7e65 commit f106e34

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,12 @@ private[quoted] object Matcher {
175175
case (Literal(constant1), Literal(constant2)) if constant1 == constant2 =>
176176
matched
177177

178-
case (Typed(expr1, tpt1), Typed(expr2, tpt2)) =>
179-
expr1 =?= expr2 && tpt1 =?= tpt2
180-
181178
case (scrutinee, Typed(expr2, _)) =>
182179
scrutinee =?= expr2
183180

181+
case (Typed(expr1, _), pattern) =>
182+
expr1 =?= pattern
183+
184184
case (Ident(_), Ident(_)) if scrutinee.symbol == pattern.symbol || summon[Env].get(scrutinee.symbol).contains(pattern.symbol) =>
185185
matched
186186

tests/run-macros/quote-matcher-runtime.check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Result: None
88

99
Scrutinee: (1: scala.Int)
1010
Pattern: 1
11-
Result: None
11+
Result: Some(List())
1212

1313
Scrutinee: (1: scala.Int)
1414
Pattern: (1: scala.Int)

0 commit comments

Comments
 (0)