-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Deprecate symbol literals #7395
Conversation
I see that you made it so that under |
last call for further discussion at scala/scala-dev#459 . my sense from the discussion there is that we are likely to merge this. |
Seems like this should move forward given the discussion so far on dropping symbol literals. There's a preponderance of evidence that this can work, so it seems marking symbol literals as deprecated can move forward. I investigated the subsequent step of experimentally dropping symbol literals entirely. I dropped them in 2.13 and backported it to 2.12. I also used a shorthand syntax for symbols in #7395, rather than I did the exercise on 2.12 so that I could see the impact on community libraries. At the time, the 2.13 community build was in too much flux. With @SethTisue's assistance, I was able drop symbol literals in 24 community projects that had literal symbols in their build, see scala/community-build#827. I added the new symbol syntax to these builds, and this resulted in 92 projects built successfully with a 2.12 compiler with symbol literals dropped. There was one project of the 24 that the new symbol syntax could not be made to work, Shapeless, but there's evidence that it could be made to work with There were 85 builds that didn't run in the 2.12 community build because a dependency failed to build or because Shapeless can't build. I stopped going further only for lack of time. |
@eed3si9n are you available to rebase this and fix CI for merge? |
3d7d26e
to
71a4c47
Compare
@SethTisue Rebased against master. |
We're only deprecating symbol literals, so there's no need to modify tests by replacing them with I'd argue that the tests should just be updated from the deprecation. I think this will do that:
† I appreciate the |
71a4c47
to
579c620
Compare
@ashawley Thanks! That was helpful. |
After changing the deprecation message, you just need to update your partests:
|
If you have it in you, you could roll back the changes to the old quoted symbol tests:
And then update the tests:
|
@ashawley Are you saying you'd prefer the symbol literal kept as-is in the tests? |
579c620
to
511f2fc
Compare
I understand the urge would be to migrate them for the sake of reducing technical debt. That may be possible for certain types of deprecations, but here it would remove the code coverage of the parser for symbol literals in the 2.13 test suite for now and evermore. I'm not sure if there are typically a lot of changes to the parser in bug-fix releases of the compiler or not, but if so I'd want to keep those symbol literal tests as-is. |
In Scala 2.13 symbol literals are being deprecated: scala/scala#7395 The recommendation from Scala 2.10.0 notes (https://github.com/scala/scala/releases/v2.13.0) is: ``` Symbol literals deprecated - Symbols themselves remain supported, only the single-quote syntax is deprecated. (scala/scala#7395) - Library designers may wish to change their APIs to use String instead. - Deprecated: 'foo - Use instead: Symbol("foo") ``` The changes in this commit will help us to avoid errors like the following when switching to 2.13: ``` [error] /Users/ioanna_kokkini/Projects/frontend/admin/app/views/commercial/adsDotText.scala.html:20:43: symbol literal is deprecated; use Symbol("_label") instead [error] @textarea(sellersForm("sellers"), '_label -> "Authorised sellers:", 'rows -> 30, 'cols -> 100, '_help -> "") ``` Co-authored-by: Roberto Tyley <roberto.tyley@guardian.co.uk>
In Scala 2.13 symbol literals are being deprecated: scala/scala#7395 The recommendation from Scala 2.10.0 notes (https://github.com/scala/scala/releases/v2.13.0) is: ``` Symbol literals deprecated - Symbols themselves remain supported, only the single-quote syntax is deprecated. (scala/scala#7395) - Library designers may wish to change their APIs to use String instead. - Deprecated: 'foo - Use instead: Symbol("foo") ``` The changes in this commit will help us to avoid errors like the following when switching to 2.13: ``` [error] /Users/ioanna_kokkini/Projects/frontend/admin/app/views/commercial/adsDotText.scala.html:20:43: symbol literal is deprecated; use Symbol("_label") instead [error] @textarea(sellersForm("sellers"), '_label -> "Authorised sellers:", 'rows -> 30, 'cols -> 100, '_help -> "") ``` Co-authored-by: Roberto Tyley <roberto.tyley@guardian.co.uk>
Ref scala/scala-dev#574