@@ -78,7 +78,8 @@ class CrossVersionChecks extends MiniPhase:
78
78
do
79
79
val msg = annot.argumentConstantString(0 ).map(msg => s " : $msg" ).getOrElse(" " )
80
80
val since = annot.argumentConstantString(1 ).map(version => s " (since: $version) " ).getOrElse(" " )
81
- report.deprecationWarning(em " inheritance from $psym is deprecated $since$msg" , parent.srcPos, origin= psym.showFullName)
81
+ val composed = em " inheritance from $psym is deprecated $since$msg"
82
+ report.deprecationWarning(composed, parent.srcPos, origin = psym.showFullName)
82
83
}
83
84
84
85
override def transformValDef (tree : ValDef )(using Context ): ValDef =
@@ -166,16 +167,19 @@ object CrossVersionChecks:
166
167
* Also check for deprecation of the companion class for synthetic methods in the companion module.
167
168
*/
168
169
private [CrossVersionChecks ] def checkDeprecatedRef (sym : Symbol , pos : SrcPos )(using Context ): Unit =
169
- def maybeWarn (annotee : Symbol , annot : Annotation ) = if ! skipWarning(sym) then
170
+ def warn (annotee : Symbol , annot : Annotation ) =
170
171
val message = annot.argumentConstantString(0 ).filter(! _.isEmpty).map(" : " + _).getOrElse(" " )
171
172
val since = annot.argumentConstantString(1 ).filter(! _.isEmpty).map(" since " + _).getOrElse(" " )
172
- report.deprecationWarning(em " ${annotee.showLocated} is deprecated ${since}${message}" , pos, origin= annotee.showFullName)
173
+ val composed = em " ${annotee.showLocated} is deprecated ${since}${message}"
174
+ report.deprecationWarning(composed, pos, origin = annotee.showFullName)
173
175
sym.getAnnotation(defn.DeprecatedAnnot ) match
174
- case Some (annot) => maybeWarn (sym, annot)
176
+ case Some (annot) => if ! skipWarning(sym) then warn (sym, annot)
175
177
case _ =>
176
178
if sym.isAllOf(SyntheticMethod ) then
177
179
val companion = sym.owner.companionClass
178
- if companion.is(CaseClass ) then companion.getAnnotation(defn.DeprecatedAnnot ).foreach(maybeWarn(companion, _))
180
+ if companion.is(CaseClass ) then
181
+ for annot <- companion.getAnnotation(defn.DeprecatedAnnot ) if ! skipWarning(sym) do
182
+ warn(companion, annot)
179
183
180
184
/** Decide whether the deprecation of `sym` should be ignored in this context.
181
185
*
0 commit comments