Skip to content

Commit 4c576e9

Browse files
committed
Remove deprecated warning in syntheic def
1 parent 609d8d6 commit 4c576e9

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

compiler/src/dotty/tools/dotc/typer/RefChecks.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -905,16 +905,19 @@ object RefChecks {
905905
owner.isDeprecated
906906
|| isEnumOwner(owner)
907907

908+
def isDeprecatedOrSyntheticMethod(owner: Symbol) = owner.isDeprecated || owner.isAllOf(Method & Synthetic)
909+
908910
/**Scan the chain of outer declaring scopes from the current context
909911
* a deprecation warning will be skipped if one the following holds
910912
* for a given declaring scope:
911-
* - the symbol associated with the scope is also deprecated.
913+
* - the symbol associated with the scope is also deprecated or synthetic method.
912914
* - if and only if `sym` is an enum case, the scope is either
913915
* a module that declares `sym`, or the companion class of the
914916
* module that declares `sym`.
915917
*/
916918
def skipWarning(using Context) =
917-
ctx.owner.ownersIterator.exists(if sym.isEnumCase then isDeprecatedOrEnum else _.isDeprecated)
919+
if sym.isEnum then ctx.owner.ownersIterator.exists(isDeprecatedOrEnum)
920+
else ctx.owner.ownersIterator.exists(isDeprecatedOrSyntheticMethod)
918921

919922
for annot <- sym.getAnnotation(defn.DeprecatedAnnot) do
920923
if !skipWarning then
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@deprecated("no CaseClass", "0.1") case class CaseClass(rgb: Int)

0 commit comments

Comments
 (0)