Skip to content

Add quote pattern bindings #6212

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 7 commits into from
Apr 16, 2019

Conversation

nicolasstucki
Copy link
Contributor

@nicolasstucki nicolasstucki commented Apr 2, 2019

Introduces Bind[T] which can be used to match a check is an Expr is a reference to some
other binding defined in scope.

  case '{ val $x: Int = ($body: Int) } => // where x: Bind[Int]
  case '{ ($x: Int) => ($body: Int) } => // where x: Bind[Int]
  case '{ ($x: Int) => ($body: Int) + x } => // where $x is the name of the parameter
  case Bind(b) => // where b: Bind[Int]
  • Add patternBindHole annotation to names staring with $ in quoted patterns
  • Handle patternBindHole in Matcher
  • Implement Bind
  • Distinguish names with back-ticks
  • Support names starting with $ in lambda parameters

@nicolasstucki nicolasstucki force-pushed the add-quote-pattern-bindings branch 9 times, most recently from dd4c4ca to 3da6139 Compare April 7, 2019 10:02
@nicolasstucki nicolasstucki self-assigned this Apr 7, 2019
@nicolasstucki nicolasstucki force-pushed the add-quote-pattern-bindings branch from 169bde6 to 3da6139 Compare April 10, 2019 08:31
@nicolasstucki nicolasstucki force-pushed the add-quote-pattern-bindings branch 11 times, most recently from c8c61db to 969a1d4 Compare April 12, 2019 08:27
@nicolasstucki nicolasstucki marked this pull request as ready for review April 12, 2019 09:47
@nicolasstucki nicolasstucki requested a review from odersky April 12, 2019 09:47
Introduces `Binding[T]` which can be used to match a check is an `Expr` is a reference to some
other binding defined in scope.

```scala
  case '{ val $x: Int = ($body: Int) } => // where x: Binding[Int]
  case '{ ($x: Int) => ($body: Int) } => // where x: Binding[Int]
  case Binding(b) => // where b: Binding[Int]
```
@nicolasstucki nicolasstucki force-pushed the add-quote-pattern-bindings branch from 969a1d4 to 87f7d52 Compare April 15, 2019 13:35
@nicolasstucki
Copy link
Contributor Author

Rebased

Copy link
Contributor

@odersky odersky 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 odersky assigned nicolasstucki and unassigned odersky Apr 16, 2019
@nicolasstucki nicolasstucki merged commit 12adbea into scala:master Apr 16, 2019
@ghost ghost removed the stat:needs review label Apr 16, 2019
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