Skip to content

Remove quoted.matching.Sym #8486

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

Conversation

nicolasstucki
Copy link
Contributor

Since quoted patterns do not return open quotes, this abstraction does not have any purpose.
The only useful part of it is extracting the name of a binding, therefore instead of returning a Sym we return the name as a String directly.

@nicolasstucki nicolasstucki self-assigned this Mar 9, 2020
@nicolasstucki nicolasstucki requested a review from liufengyun March 9, 2020 19:48
@nicolasstucki nicolasstucki marked this pull request as ready for review March 9, 2020 20:21
@@ -14,22 +14,22 @@ object Test {
case '{ 1 + ($y: Int)} => y
case '{ val a = 1 + ($y: Int); 3 } => y
case '{ val $y: Int = $z; println(`$y`); 1 } =>
val a: quoted.matching.Sym[Int] = y
val a: String = y
Copy link
Contributor

Choose a reason for hiding this comment

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

If y is String, the semantics for the reference to y in println($y) becomes problematic.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why? Could you elaborate

Copy link
Contributor

Choose a reason for hiding this comment

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

After discussion, now I see the $y in val $y = e has double meaning.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In general, a $ can be in an expression position (Expr[T]), type position (Type[T]) or definition position (String)

@liufengyun liufengyun removed their assignment Mar 10, 2020
Copy link
Contributor

@liufengyun liufengyun left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -14,22 +14,22 @@ object Test {
case '{ 1 + ($y: Int)} => y
case '{ val a = 1 + ($y: Int); 3 } => y
case '{ val $y: Int = $z; println(`$y`); 1 } =>
val a: quoted.matching.Sym[Int] = y
val a: String = y
Copy link
Contributor

Choose a reason for hiding this comment

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

After discussion, now I see the $y in val $y = e has double meaning.

Since quoted patterns do not return open quotes, this abstraction does not have any purpose.
The only useful part of it is extracting the name of a binding, therefore instead of returning a Sym we return the name as a String directly.
@nicolasstucki nicolasstucki force-pushed the remove-quoted-matching-sym branch from 27c00df to 721223f Compare March 11, 2020 10:50
@nicolasstucki
Copy link
Contributor Author

Rebased

@nicolasstucki nicolasstucki merged commit 800251d into scala:master Mar 11, 2020
@nicolasstucki nicolasstucki deleted the remove-quoted-matching-sym branch March 11, 2020 11:56
@anatoliykmetyuk anatoliykmetyuk added this to the 0.23.0-RC1 milestone Mar 12, 2020
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.

3 participants