Skip to content

Commit 824295e

Browse files
Don't render the "$" for module (#17302)
In this PR: - I deleted the $ in the file `NameNormalizer` - The ownerNameChain extension method generates a list of normalized owner names for a symbol, starting with the immediate owner and ending with the top-level owner. The normalizedFullName extension method combines the results of ownerNameChain into a single string with "." separators. ### Before: <img width="800" alt="Screenshot 2023-04-24 at 13 06 12" src="https://user-images.githubusercontent.com/44496264/233979570-da502b7a-58c0-4486-a4bc-91fd5ea94e5b.png"> <img width="800" alt="Screenshot 2023-04-24 at 13 06 21" src="https://user-images.githubusercontent.com/44496264/233979575-d7dbc0a9-db40-4e07-ad42-731ed17700e2.png"> ### After: <img width="800" alt="Screenshot 2023-04-24 at 13 07 35" src="https://user-images.githubusercontent.com/44496264/233979596-ad5f032d-92e5-4673-af5d-6b75a0649466.png"> <img width="800" alt="Screenshot 2023-04-24 at 13 07 42" src="https://user-images.githubusercontent.com/44496264/233979600-677d188d-6a9c-45c4-89ee-ea7b0b2bc010.png"> Fixes: #15880
2 parents 65bb700 + d26d076 commit 824295e

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

scaladoc/src/dotty/tools/scaladoc/tasty/ClassLikeSupport.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ trait ClassLikeSupport:
529529
experimental: Option[Annotation] = None
530530
) = Member(
531531
name = symbol.normalizedName,
532-
fullName = symbol.fullName,
532+
fullName = symbol.normalizedFullName,
533533
dri = symbol.dri,
534534
kind = kind,
535535
visibility = symbol.getVisibility(),

scaladoc/src/dotty/tools/scaladoc/tasty/NameNormalizer.scala

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,18 @@ object NameNormalizer {
1717
val escaped = escapedName(constructorNormalizedName)
1818
escaped
1919
}
20+
21+
def ownerNameChain: List[String] = {
22+
import reflect.*
23+
if s.isNoSymbol then List.empty
24+
else if s == defn.EmptyPackageClass then List.empty
25+
else if s == defn.RootPackage then List.empty
26+
else if s == defn.RootClass then List.empty
27+
else s.owner.ownerNameChain :+ s.normalizedName
28+
}
29+
30+
def normalizedFullName: String =
31+
s.ownerNameChain.mkString(".")
2032

2133
private val ignoredKeywords: Set[String] = Set("this")
2234

0 commit comments

Comments
 (0)