-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix #10247: skip deprecation warnings in synthetic definitions #10996
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
Conversation
Yes, user code can be moved inside a synthetic definition (for example, the body of an anonymous class, the body of a lambda, etc). How does Scala 2 deal with this problem? |
scala 2 does the same: with configurable warnings ported you could suppress deprecation warnings with a |
Is it the same? I see that it skips deprecated warning inside deprecated definition but I don't see anything about synthetic. |
sorry I meant the same as status quo in Dotty |
Final alternative could scan for |
If we can't find other problematic cases than enums then I would just special case that: a deprecated enum case used anywhere inside the |
^ This would be fine with me. for the sake of a counter argument Scala 2 would complain about using a deprecated definition in the same scope it is declared: sealed trait Color
object Color {
@deprecated("stop using Red") case object Red extends Color
case object Green extends Color
case object Blue extends Color
def values = Array(Red, Green, Blue)
// ^
// 6: warning: object Red in object Color is deprecated: stop using Red
} Overall, I agree it would be consistent to apply the rule across a whole enum declaration. This would allow for layering on top a model for enums that can deprecate cases |
will reopen a new pr with the different changes |
fixes #10247
In this change we avoid all deprecation warnings when directly within a synthetic definition.
perhaps this is too permissive? i.e. Is there a place desirable for a synthetic def to warn about calling a deprecated member?
e.g. in this example in issue #10247 the enum case
Red
is deprecated, but is used to define both thevalues
array and thevalueOf
lookup method, but these should not cause warnings