@@ -78,7 +78,8 @@ class CrossVersionChecks extends MiniPhase:
7878 do
7979 val msg = annot.argumentConstantString(0 ).map(msg => s " : $msg" ).getOrElse(" " )
8080 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)
8283 }
8384
8485 private def unrollError (pos : SrcPos )(using Context ): Unit =
@@ -203,16 +204,19 @@ object CrossVersionChecks:
203204 * Also check for deprecation of the companion class for synthetic methods in the companion module.
204205 */
205206 private [CrossVersionChecks ] def checkDeprecatedRef (sym : Symbol , pos : SrcPos )(using Context ): Unit =
206- def maybeWarn (annotee : Symbol , annot : Annotation ) = if ! skipWarning(sym) then
207+ def warn (annotee : Symbol , annot : Annotation ) =
207208 val message = annot.argumentConstantString(0 ).filter(! _.isEmpty).map(" : " + _).getOrElse(" " )
208209 val since = annot.argumentConstantString(1 ).filter(! _.isEmpty).map(" since " + _).getOrElse(" " )
209- report.deprecationWarning(em " ${annotee.showLocated} is deprecated ${since}${message}" , pos, origin= annotee.showFullName)
210+ val composed = em " ${annotee.showLocated} is deprecated ${since}${message}"
211+ report.deprecationWarning(composed, pos, origin = annotee.showFullName)
210212 sym.getAnnotation(defn.DeprecatedAnnot ) match
211- case Some (annot) => maybeWarn (sym, annot)
213+ case Some (annot) => if ! skipWarning(sym) then warn (sym, annot)
212214 case _ =>
213215 if sym.isAllOf(SyntheticMethod ) then
214216 val companion = sym.owner.companionClass
215- if companion.is(CaseClass ) then companion.getAnnotation(defn.DeprecatedAnnot ).foreach(maybeWarn(companion, _))
217+ if companion.is(CaseClass ) then
218+ for annot <- companion.getAnnotation(defn.DeprecatedAnnot ) if ! skipWarning(sym) do
219+ warn(companion, annot)
216220
217221 /** Decide whether the deprecation of `sym` should be ignored in this context.
218222 *
0 commit comments