Skip to content
New issue

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

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

Already on GitHub? # to your account

Handle this prefix in classes (in quote patterns) #14800

Merged
merged 3 commits into from
Apr 20, 2022

Conversation

nicolasstucki
Copy link
Contributor

Fixes #14788

@nicolasstucki nicolasstucki changed the title Handle this prefix in classes (in quote patterns) #14732 Handle this prefix in classes (in quote patterns) Mar 31, 2022
@nicolasstucki nicolasstucki marked this pull request as ready for review April 1, 2022 05:55
@nicolasstucki nicolasstucki requested a review from smarter April 1, 2022 05:56
case TermRef(qual: ThisType, _) if qual.classSymbol.is(Module, butNot = Package) =>
tpd.ref(qual.classSymbol.companionModule) =?= qual2
case _ => matched
case ref: Ident if qual2.symbol == defn.QuotedRuntimePatterns_patternHole =>
Copy link
Member

Choose a reason for hiding this comment

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

Why is patternHole special-cased now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If the pattern does not contain a hole, then we do not need to extract a value and can just call matched directly. The code was updated to cover holes in any part of the prefix.

@smarter smarter assigned nicolasstucki and unassigned smarter Apr 12, 2022
@smarter smarter enabled auto-merge April 20, 2022 15:10
@smarter smarter merged commit 0040417 into scala:main Apr 20, 2022
@smarter smarter deleted the fix-14788 branch April 20, 2022 16:35
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expr match throws ClassCastException: scala.Tuple1 cannot be cast to scala.Tuple2
2 participants