Skip to content
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

Deprecation warnings for old syntax: private[this] #18819

Conversation

nicolasstucki
Copy link
Contributor

@nicolasstucki nicolasstucki commented Nov 1, 2023

This is the first part of #18863

  • In 3.4 we emit the deprecation warning and enable the patch with -rewrite.
  • In future we emit we make this syntax an error
//> using options -source future
private[this] def foo: Int = ??? // error
//> using options -rewrite -source 3.4-migration
- private[this] def foo: Int = ???
+ private def foo: Int = ???

@nicolasstucki nicolasstucki self-assigned this Nov 1, 2023
@nicolasstucki nicolasstucki force-pushed the private-this-migration-warining-and-patch branch from 73f63c8 to 96f88a0 Compare November 2, 2023 07:39
@nicolasstucki nicolasstucki changed the title Make private[this] a migration warning Future migration warning for private[this] Nov 2, 2023
@nicolasstucki nicolasstucki changed the title Future migration warning for private[this] Future migration patch for private[this] Nov 2, 2023
@nicolasstucki nicolasstucki changed the title Future migration patch for private[this] Future migration warning for private[this] Nov 2, 2023
@nicolasstucki nicolasstucki marked this pull request as ready for review November 2, 2023 10:08
@nicolasstucki nicolasstucki force-pushed the private-this-migration-warining-and-patch branch 2 times, most recently from b2e7a55 to 3717e1a Compare November 2, 2023 16:17
@nicolasstucki nicolasstucki removed the request for review from smarter November 7, 2023 09:11
@nicolasstucki nicolasstucki changed the title Future migration warning for private[this] Deprecation warnings for old syntax(private[this]) Nov 7, 2023
@nicolasstucki nicolasstucki changed the title Deprecation warnings for old syntax(private[this]) Deprecation warnings for old syntax: private[this] Nov 7, 2023
@nicolasstucki nicolasstucki force-pushed the private-this-migration-warining-and-patch branch 4 times, most recently from c5167ae to 5c795df Compare November 7, 2023 14:16
@nicolasstucki nicolasstucki added this to the 3.4.0 milestone Nov 7, 2023
@nicolasstucki nicolasstucki force-pushed the private-this-migration-warining-and-patch branch 2 times, most recently from db84c48 to b676153 Compare November 7, 2023 15:21
Copy link
Member

@smarter smarter left a comment

Choose a reason for hiding this comment

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

LGTM, but this is going to be a problem for code that cross-compiles with Scala 2 where private[this] might be needed to avoid variance errors. I wish we had a flag to silence all warnings that can prevent cross-compilation.

@sjrd
Copy link
Member

sjrd commented Nov 7, 2023

The consensus what that that flag would be -source:3.3.

@smarter
Copy link
Member

smarter commented Nov 7, 2023

OK, something we'll have to make sure is well communicated then.

@nicolasstucki nicolasstucki force-pushed the private-this-migration-warining-and-patch branch from b676153 to 4b01f58 Compare November 7, 2023 16:46
@sjrd
Copy link
Member

sjrd commented Nov 7, 2023

Also, if you cross-compile, it means you care about your users being able to use older versions of the compiler. Presumably that includes Scala 3.3.x LTS users. So in fact you should keep compiling with 3.3.x and not upgrade to 3.4+.

@SethTisue
Copy link
Member

I wish we had a flag to silence all warnings that can prevent cross-compilation

I said the same thing at the Dotty meeting yesterday :-) So yeah, the crew is aware.

@nicolasstucki nicolasstucki added the release-notes Should be mentioned in the release notes label Nov 8, 2023
@nicolasstucki
Copy link
Contributor Author

this is going to be a problem for code that cross-compiles with Scala 2 where private[this] might be needed to avoid variance errors. I wish we had a flag to silence all warnings that can prevent cross-compilation.

The consensus what that that flag would be -source:3.3.

This should also be mentioned in the release notes

* In `3.4` we emit the deprecation warning and enable the patch with -rewrite.
* In `future` we emit we make this syntax an error
@nicolasstucki nicolasstucki force-pushed the private-this-migration-warining-and-patch branch from 4b01f58 to a0699ae Compare November 8, 2023 07:03
@nicolasstucki nicolasstucki merged commit dc0b43c into scala:main Nov 8, 2023
18 checks passed
@nicolasstucki nicolasstucki deleted the private-this-migration-warining-and-patch branch November 8, 2023 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-notes Should be mentioned in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants