Skip to content

Remove deprecated warning in synthetic def #11055

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

Closed
wants to merge 3 commits into from

Conversation

changvvb
Copy link
Contributor

@changvvb changvvb commented Jan 11, 2021

Fixes #11022

Copy link
Member

@bishabosha bishabosha left a comment

Choose a reason for hiding this comment

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

Thank you for opening this PR, I will link to this comment on why we need to be careful with ignoring synthetic defs which I see you already protect against some cases: #10996 (comment)

@changvvb
Copy link
Contributor Author

Thank you for opening this PR, I will link to this comment on why we need to be careful with ignoring synthetic defs which I see you already protect against some cases: #10996 (comment)

@bishabosha I want to know some cases that we should warn in synthetic scope

@smarter
Copy link
Member

smarter commented Jan 11, 2021

I want to know some cases that we should warn in synthetic scope

I mentioned some cases in #10996 (comment), as far as I can tell this PR has the same issues as #10996 and should be rejected for the same reason in favor of what I suggested in #10996 (comment)

@changvvb
Copy link
Contributor Author

I checked these cases and got the following results:

@deprecated("no CaseClass", "0.1") case class CaseClass(rgb: Int)

object Test {

  abstract class TestX

  val x = new TestX {
    val obj = new CaseClass(5) // warn
  }

  val y = Option(5).map(new CaseClass(_)) // warn
  val z = CaseClass(4)  // not warn but seems not related with this PR
}

But I agree that should not check synthetic flag only.

@changvvb
Copy link
Contributor Author

@bishabosha @smarter Is it possible to check the sourcePos of ctx owners? we can check whether exists owner sourcePos that

  1. is not <no position>
  2. is not sourcePos of the deprecated symbol.

I think the user code must have a valid sourcePos right?

@changvvb
Copy link
Contributor Author

@bishabosha @smarter Is it possible to check the sourcePos of ctx owners? we can check whether exists owner sourcePos that

  1. is not <no position>
  2. is not sourcePos of the deprecated symbol.

I think the user code must have a valid sourcePos right?

This is not a good solution because should disable not only deprecated warnings but also other warnings in synthetic scope.

@changvvb changvvb closed this Jan 12, 2021
@changvvb changvvb deleted the fix-deprecated branch January 15, 2021 00:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

deprecated case class warns at its definition
3 participants