Skip to content

Do not rename names starting with $ in quoted patterns #6347

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
Apr 22, 2019

Conversation

nicolasstucki
Copy link
Contributor

Previously we renamed val $a to val a and at the same time created a binding
named a. A reference to a inside a splice could not be disambiguated.

case '{ val $a: Int = 4; `$a` + ${ ... a ... '{ .. `$a` .. } ... } } => a

This change allows us to both refer to the a binding and the $a reference inside splices without ambiguities.

Previously we renamed `val $a` to `val a` and at the same time created a binding
named `a`. A reference to `a` inside a splice could not be disambiguated.

```scala
case '{ val $a: Int = 4; `$a` + ${ ... a ... '{ .. `$a` .. } ... } } => a
```

This change allows us to both refer to the `a` binding and the `$a` reference inside splices without ambiguities.
@nicolasstucki nicolasstucki marked this pull request as ready for review April 20, 2019 16:25
@nicolasstucki nicolasstucki requested a review from odersky April 20, 2019 16:26
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.

Looks OK to me. Do we still need backquoted ValDefs and DefDefs with this change?

@nicolasstucki
Copy link
Contributor Author

Yes, we still depend on quoted ValDef and DefDef during desugaring.

@odersky
Copy link
Contributor

odersky commented Apr 22, 2019

Yes, we still depend on quoted ValDef and DefDef during desugaring.

Let's try to get rid of this in a separate PR!

@odersky odersky merged commit b255543 into scala:master Apr 22, 2019
@allanrenucci allanrenucci deleted the do-not-rename-quoted-bindings branch April 22, 2019 20:55
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