@@ -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 override def transformValDef (tree : ValDef )(using Context ): ValDef =
@@ -166,16 +167,19 @@ object CrossVersionChecks:
166167 * Also check for deprecation of the companion class for synthetic methods in the companion module.
167168 */
168169 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 ) =
170171 val message = annot.argumentConstantString(0 ).filter(! _.isEmpty).map(" : " + _).getOrElse(" " )
171172 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)
173175 sym.getAnnotation(defn.DeprecatedAnnot ) match
174- case Some (annot) => maybeWarn (sym, annot)
176+ case Some (annot) => if ! skipWarning(sym) then warn (sym, annot)
175177 case _ =>
176178 if sym.isAllOf(SyntheticMethod ) then
177179 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)
179183
180184 /** Decide whether the deprecation of `sym` should be ignored in this context.
181185 *
0 commit comments