Skip to content

Deprecate Yno-kind-polymorphism #22814

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 3 commits into from
Mar 18, 2025

Conversation

Linyxus
Copy link
Contributor

@Linyxus Linyxus commented Mar 15, 2025

Fixes #22029.

@Linyxus Linyxus requested a review from Gedochao March 15, 2025 21:02
@Linyxus
Copy link
Contributor Author

Linyxus commented Mar 15, 2025

One problem I have is that after @deprecate the field in ScalaSetting, the compiler is not allowed to access the field any further (other wise a deprecation warning is issued), so in this PR we will simply ignore the value of -Yno-kind-polymorphism in the compiler. Would that bring problems?

@som-snytt
Copy link
Contributor

I think this is an example of deprecating the option deprecation = Deprecation.removed() and not just the field. Then users are alerted?

@deprecated(message = "Scheduled for removal.", since = "3.5.0")
  val YoutputOnlyTasty: Setting[Boolean] = BooleanSetting(ForkSetting, "Youtput-only-tasty", "Used to only generate the TASTy file without the classfiles", deprecation = Deprecation.removed())

@Gedochao
Copy link
Contributor

Gedochao commented Mar 17, 2025

One problem I have is that after @deprecate the field in ScalaSetting, the compiler is not allowed to access the field any further (other wise a deprecation warning is issued), so in this PR we will simply ignore the value of -Yno-kind-polymorphism in the compiler. Would that bring problems?

Hmm... it's not really deprecation if the value is no longer respected. The resulting behaviour will be inconsistent.
However, it is a private -Y option, so we give no guarantees about it... Maybe we could straight-up remove it? EDIT: Eh, we shouldn't error on it for at least one minor, I guess. We ought to remove it before the new LTS though.
@sjrd thoughts?

@Gedochao Gedochao requested a review from sjrd March 17, 2025 08:25
@sjrd
Copy link
Member

sjrd commented Mar 17, 2025

TBH the type system of Scala 3 just does not work without AnyKind. This flag has always been a gimmick. I suggest writing a deprecation message stating that it has no effect. And then actually error out sometime later.

@Gedochao Gedochao added release-notes Should be mentioned in the release notes backport:nominated If we agree to backport this PR, replace this tag with "backport:accepted", otherwise delete it. labels Mar 17, 2025
@Gedochao
Copy link
Contributor

BTW @WojciechMazur we should backport it to 3.7.0-RC2 when it gets merged.

@Linyxus
Copy link
Contributor Author

Linyxus commented Mar 17, 2025

ready for review :)

@Gedochao Gedochao merged commit 4b09b13 into scala:main Mar 18, 2025
29 checks passed
@SethTisue SethTisue deleted the deprecate-no-kind-polymorphism branch March 18, 2025 14:21
@WojciechMazur WojciechMazur added this to the 3.7.0 milestone Apr 7, 2025
WojciechMazur pushed a commit that referenced this pull request Apr 7, 2025
@WojciechMazur WojciechMazur added backport:accepted This PR needs to be backported, once it's been backported replace this tag by "backport:done" and removed backport:nominated If we agree to backport this PR, replace this tag with "backport:accepted", otherwise delete it. labels Apr 7, 2025
WojciechMazur added a commit that referenced this pull request Apr 8, 2025
Backports #22814 to the 3.7.0-RC2.

PR submitted by the release tooling.
@WojciechMazur WojciechMazur added backport:done This PR was successfully backported. and removed backport:accepted This PR needs to be backported, once it's been backported replace this tag by "backport:done" labels Apr 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:done This PR was successfully backported. release-notes Should be mentioned in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deprecate -Yno-kind-polymorphism and update the relevant docs
5 participants