Skip to content

Add quoted patterns #6198

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 12 commits into from
Apr 2, 2019
Merged

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Mar 31, 2019

No description provided.

@nicolasstucki nicolasstucki self-requested a review March 31, 2019 17:16
@@ -16,4 +16,7 @@ object Quoted {
def typeQuote[T <: AnyKind]: Type[T] =
throw new Error("Internal error: this method call should have been replaced by the compiler")

/** A splice in a quoted pattern is desugared by the compiler into a call to this method */
def patternHole[T]: T =
Copy link
Contributor

Choose a reason for hiding this comment

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

Note: this is the equivalent to def hole[T] in #6042, not to be confused with object patternHole { def unapply[T] = ... }.

@odersky
Copy link
Contributor Author

odersky commented Apr 1, 2019

Status: FromTasty test fails on quotedPatterns.scala, presumably because there are (unreachable) warnings. Otherwise we seem to be good.

@odersky odersky marked this pull request as ready for review April 1, 2019 09:29
odersky and others added 9 commits April 1, 2019 17:57
Also, cleanup some other stuff. Not done with this yet, but it is crucial
that we follow the same pattern everywhere in Definition, or otherwise people
will get hopelessly confused. Right now some of the more recent additions
use naming conventions that deviate from what was intended.
Previously, the case where arity = 1 was treated specially.
Now we can have patterns that do not have a full tree (i.e. just an Ident to the `unapply`)
@nicolasstucki
Copy link
Contributor

Rebased

@nicolasstucki nicolasstucki added this to the 0.15 Tech Preview milestone Apr 1, 2019
Copy link
Contributor

@nicolasstucki nicolasstucki left a comment

Choose a reason for hiding this comment

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

Otherwise LGTM

@odersky
Copy link
Contributor Author

odersky commented Apr 2, 2019

@nicolasstucki Your commits LGTM

@odersky odersky removed their assignment Apr 2, 2019
@nicolasstucki nicolasstucki merged commit 3d19187 into scala:master Apr 2, 2019
@nicolasstucki nicolasstucki deleted the add-quote-patterns branch April 2, 2019 11:25
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.

2 participants