Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Revert exclusion of companion for reporting deprecation #10311

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 1 commit into from
Mar 29, 2023

Conversation

som-snytt
Copy link
Contributor

@som-snytt som-snytt commented Feb 14, 2023

Update spec for accommodation at #10071

Instead of granting companions immunity from deprecation, make them explicitly choose whether to propagate the deprecation or explicitly nowarn.

Avoid trailing colon if message is empty. (Parity with fix in dotty.)

@scala-jenkins scala-jenkins added this to the 2.13.11 milestone Feb 14, 2023
@som-snytt
Copy link
Contributor Author

Why did I think Travis would let me "tweak" the spec? What hubris!

@lrytz lrytz mentioned this pull request Feb 15, 2023
@SethTisue SethTisue self-assigned this Feb 16, 2023
@SethTisue

This comment was marked as outdated.

@SethTisue

This comment was marked as outdated.

@som-snytt
Copy link
Contributor Author

When the brain fog lifts, I'd like to take a moment to review whether expanding deprecation exemption via companion is a good idea. It came up on dotty for the same reason. Trying to minimize future reversions for @lrytz .

@SethTisue SethTisue removed their assignment Feb 21, 2023
@SethTisue SethTisue modified the milestones: 2.13.11, 2.13.12 Feb 28, 2023
@som-snytt som-snytt changed the title Tweak spec and report of deprecation Revert exclusion of companion for reporting deprecation Mar 22, 2023
@som-snytt som-snytt marked this pull request as ready for review March 22, 2023 19:01
@som-snytt som-snytt modified the milestones: 2.13.12, 2.13.11 Mar 22, 2023
@SethTisue
Copy link
Member

What PR does this revert?

@som-snytt
Copy link
Contributor Author

som-snytt commented Mar 22, 2023

It's crossed out in the first comment.

This doesn't revert the direct fix, but the expanded immunity to deprecation.

@SethTisue SethTisue self-assigned this Mar 22, 2023
@lrytz
Copy link
Member

lrytz commented Mar 28, 2023

Shouldn't the deprecation be copied over to the companion?

diff --git a/src/library/scala/deprecated.scala b/src/library/scala/deprecated.scala
index 1459cd8192..25b7b54619 100644
--- a/src/library/scala/deprecated.scala
+++ b/src/library/scala/deprecated.scala
@@ -56,6 +56,6 @@ import scala.annotation.meta._
  *  @see    [[scala.deprecatedOverriding]]
  *  @see    [[scala.deprecatedName]]
  */
-@getter @setter @beanGetter @beanSetter @field
+@getter @setter @beanGetter @beanSetter @field @companionObject
 @deprecatedInheritance("Scheduled for being final in the future", "2.13.0")
 class deprecated(message: String = "", since: String = "") extends scala.annotation.ConstantAnnotation

(except that @companionObject doesn't seem to be implemented)

@SethTisue SethTisue assigned som-snytt and unassigned SethTisue Mar 28, 2023
@som-snytt
Copy link
Contributor Author

som-snytt commented Mar 28, 2023

@lrytz deprecating the companion is the previous/old behavior objected to on the related dotty ticket.

(test neg/t2799.scala)

@lrytz
Copy link
Member

lrytz commented Mar 29, 2023

OK, thanks. scala/scala3#12706 (comment)

I was thinking to deprecate synthetic companions derived from deprecated classes, but then that doesn't work if the companion exists in source.

Also, deprecating the module class (95d7ef40eb) instead of the module symbol was probably unintended magic :)

@lrytz lrytz merged commit eeb55a8 into scala:2.13.x Mar 29, 2023
@som-snytt som-snytt deleted the tweak/deprecation branch March 29, 2023 15:13
SethTisue added a commit to SethTisue/scala that referenced this pull request Mar 30, 2023
as uncovered by recent merge of scala#10311
@som-snytt
Copy link
Contributor Author

This did not revert the code comment. I need tooling that detects nearby code comments and verifies whether I intended to update the comments.

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.

4 participants