Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions library/src/scala/internal/quoted/Matcher.scala
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@ private[quoted] object Matcher {
case (Literal(constant1), Literal(constant2)) if constant1 == constant2 =>
matched

case (Typed(expr1, tpt1), Typed(expr2, tpt2)) =>
expr1 =?= expr2 && tpt1 =?= tpt2
case (Typed(expr1, _), pattern) =>
expr1 =?= pattern
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This means there is no way to match against a typed expression. It's fine in practice. As this is a design choice, it's better to add a small doc here, and add a link to the relevant issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That should be added to the docs in #8687. These do not exist yet.


case (scrutinee, Typed(expr2, _)) =>
scrutinee =?= expr2
Expand Down
2 changes: 1 addition & 1 deletion tests/run-macros/quote-matcher-runtime.check
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Result: None

Scrutinee: (1: scala.Int)
Pattern: 1
Result: None
Result: Some(List())

Scrutinee: (1: scala.Int)
Pattern: (1: scala.Int)
Expand Down