Skip to content

Move treeMatch into QuoteMatcher #17236

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 24, 2023

Conversation

nicolasstucki
Copy link
Contributor

@nicolasstucki nicolasstucki commented Apr 12, 2023

No description provided.

@nicolasstucki nicolasstucki changed the title Move treeMatch into QuoteMatcher Move treeMatch into QuoteMatcher Apr 12, 2023
@nicolasstucki nicolasstucki marked this pull request as ready for review April 17, 2023 07:03
@nicolasstucki nicolasstucki requested review from smarter and removed request for natsukagami May 24, 2023 08:49
@nicolasstucki nicolasstucki assigned smarter and unassigned natsukagami May 24, 2023
(pat, Nil)

val (pat1, typeHoles) = extractTypeHoles(pattern)
def exprMatch(scrutinee: Tree, pattern: Tree)(using Context): Option[Tuple] = {
Copy link
Member

Choose a reason for hiding this comment

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

what's the advantage of splitting treeMatch like this? It seems we end up with quite a few lines duplicated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No sure anymore.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I refactored the code to only keep treeMatch as before. But added some optimizations to avoid using the TypeMap when it is not going to do anything.

@smarter smarter assigned nicolasstucki and unassigned smarter May 24, 2023
@nicolasstucki nicolasstucki force-pushed the move-treeMatch-into-QuoteMatcher branch from 0acb329 to c5e40ea Compare May 24, 2023 12:57
Now we do not use use the TypeMap if there is no type to map.
We also do not create the type map if there are no expression that may
contain types that need mapping.
@nicolasstucki nicolasstucki force-pushed the move-treeMatch-into-QuoteMatcher branch from c5e40ea to aad8475 Compare May 24, 2023 13:10
@nicolasstucki nicolasstucki requested a review from smarter May 24, 2023 13:12
@smarter smarter enabled auto-merge May 24, 2023 13:55
@smarter smarter merged commit 8f8fc36 into scala:main May 24, 2023
@smarter smarter deleted the move-treeMatch-into-QuoteMatcher branch May 24, 2023 17:37
Kordyjan added a commit that referenced this pull request Nov 17, 2023
Backports #17236 to the LTS branch.

PR submitted by the release tooling.
@Kordyjan Kordyjan added this to the 3.3.2 milestone Dec 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants