diff --git a/scaladoc/src/dotty/tools/scaladoc/api.scala b/scaladoc/src/dotty/tools/scaladoc/api.scala index 314dcc3c7261..a59f1512dbf9 100644 --- a/scaladoc/src/dotty/tools/scaladoc/api.scala +++ b/scaladoc/src/dotty/tools/scaladoc/api.scala @@ -82,7 +82,7 @@ enum Origin: case class Overridden(name: String, dri: DRI) -case class InheritedFrom(name: String, dri: DRI) +case class InheritedFrom(name: String, dri: DRI, isSourceSuperclassHidden: Boolean) case class Annotation(val dri: DRI, val params: List[Annotation.AnnotationParameter]) diff --git a/scaladoc/src/dotty/tools/scaladoc/renderers/MemberRenderer.scala b/scaladoc/src/dotty/tools/scaladoc/renderers/MemberRenderer.scala index 19dd4e4b7403..1980459dd097 100644 --- a/scaladoc/src/dotty/tools/scaladoc/renderers/MemberRenderer.scala +++ b/scaladoc/src/dotty/tools/scaladoc/renderers/MemberRenderer.scala @@ -29,7 +29,9 @@ class MemberRenderer(signatureRenderer: SignatureRenderer)(using DocContext) ext case _ => Nil def inheritedFrom(m: Member) = m.inheritedFrom match - case Some(InheritedFrom(name, dri)) => tableRow("Inherited from:", signatureRenderer.renderLink(name, dri)) + case Some(InheritedFrom(name, dri, isSourceSuperclassHidden)) => + val hiddenNameSuffix = if isSourceSuperclassHidden then " (hidden)" else "" + tableRow("Inherited from:", signatureRenderer.renderLink(name + hiddenNameSuffix, dri)) case _ => Nil def docAttributes(m: Member): Seq[AppliedTag] = diff --git a/scaladoc/src/dotty/tools/scaladoc/renderers/Resources.scala b/scaladoc/src/dotty/tools/scaladoc/renderers/Resources.scala index 5a5e60f08879..fad9c5837e09 100644 --- a/scaladoc/src/dotty/tools/scaladoc/renderers/Resources.scala +++ b/scaladoc/src/dotty/tools/scaladoc/renderers/Resources.scala @@ -150,7 +150,7 @@ trait Resources(using ctx: DocContext) extends Locations, Writer: val entry = mkEntry(member.dri, member.name, flattenToText(sig), descr, member.kind.name) val children = member .membersBy(m => m.kind != Kind.Package && !m.kind.isInstanceOf[Classlike]) - .filter(m => m.origin == Origin.RegularlyDefined && m.inheritedFrom.isEmpty) + .filter(m => m.origin == Origin.RegularlyDefined && (m.inheritedFrom.isEmpty || m.inheritedFrom.get.isSourceSuperclassHidden)) Seq(entry) ++ children.flatMap(processMember) processMember(m) diff --git a/scaladoc/src/dotty/tools/scaladoc/tasty/ClassLikeSupport.scala b/scaladoc/src/dotty/tools/scaladoc/tasty/ClassLikeSupport.scala index 31e27e234332..7d5886193c6b 100644 --- a/scaladoc/src/dotty/tools/scaladoc/tasty/ClassLikeSupport.scala +++ b/scaladoc/src/dotty/tools/scaladoc/tasty/ClassLikeSupport.scala @@ -183,7 +183,7 @@ trait ClassLikeSupport: } private def parseInheritedMember(c: ClassDef)(s: Tree): Option[Member] = - def inheritance = Some(InheritedFrom(s.symbol.owner.normalizedName, s.symbol.dri)) + def inheritance = Some(InheritedFrom(s.symbol.owner.normalizedName, s.symbol.dri, s.symbol.owner.isHiddenByVisibility)) processTreeOpt(s)(s match case c: ClassDef if c.symbol.shouldDocumentClasslike => Some(parseClasslike(c, signatureOnly = true)) case other => { diff --git a/scaladoc/src/dotty/tools/scaladoc/translators/FilterAttributes.scala b/scaladoc/src/dotty/tools/scaladoc/translators/FilterAttributes.scala index 1202e76a548c..7c43d378fab5 100644 --- a/scaladoc/src/dotty/tools/scaladoc/translators/FilterAttributes.scala +++ b/scaladoc/src/dotty/tools/scaladoc/translators/FilterAttributes.scala @@ -14,7 +14,7 @@ object FilterAttributes: Map("visibility" -> m.visibility.name) private def inheritedFrom(m: Member): Map[String, String] = m.inheritedFrom match - case Some(InheritedFrom(name, _)) => Map("inherited" -> name) + case Some(InheritedFrom(name, _, _)) => Map("inherited" -> name) case _ => Map.empty private def origin(m: Member): Map[String, String] = m.origin match