From d26d076513b7240b4ae4c6393147603d95669ac6 Mon Sep 17 00:00:00 2001 From: Lucas Date: Fri, 14 Apr 2023 11:46:41 +0200 Subject: [PATCH] Don't render the "$" for module Change of how to correct the Issue - Add a new method "normalizedFullName" - Call the method "ClassLikeSupport" Add the ownerNameChain function - To erase the $ in all the hierarchy --- .../tools/scaladoc/tasty/ClassLikeSupport.scala | 2 +- .../dotty/tools/scaladoc/tasty/NameNormalizer.scala | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/scaladoc/src/dotty/tools/scaladoc/tasty/ClassLikeSupport.scala b/scaladoc/src/dotty/tools/scaladoc/tasty/ClassLikeSupport.scala index 0c85dff0879f..86c745f12db7 100644 --- a/scaladoc/src/dotty/tools/scaladoc/tasty/ClassLikeSupport.scala +++ b/scaladoc/src/dotty/tools/scaladoc/tasty/ClassLikeSupport.scala @@ -525,7 +525,7 @@ trait ClassLikeSupport: experimental: Option[Annotation] = None ) = Member( name = symbol.normalizedName, - fullName = symbol.fullName, + fullName = symbol.normalizedFullName, dri = symbol.dri, kind = kind, visibility = symbol.getVisibility(), diff --git a/scaladoc/src/dotty/tools/scaladoc/tasty/NameNormalizer.scala b/scaladoc/src/dotty/tools/scaladoc/tasty/NameNormalizer.scala index 687ad6ecbf44..196c3e056b36 100644 --- a/scaladoc/src/dotty/tools/scaladoc/tasty/NameNormalizer.scala +++ b/scaladoc/src/dotty/tools/scaladoc/tasty/NameNormalizer.scala @@ -17,6 +17,18 @@ object NameNormalizer { val escaped = escapedName(constructorNormalizedName) escaped } + + def ownerNameChain: List[String] = { + import reflect.* + if s.isNoSymbol then List.empty + else if s == defn.EmptyPackageClass then List.empty + else if s == defn.RootPackage then List.empty + else if s == defn.RootClass then List.empty + else s.owner.ownerNameChain :+ s.normalizedName + } + + def normalizedFullName: String = + s.ownerNameChain.mkString(".") private val ignoredKeywords: Set[String] = Set("this")