-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Scala3doc: Bugfixes related to symbol names and extension methods #10334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
ed1ef0d
752cb1b
424c093
02aedfa
01dcb59
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package dotty.dokka.tasty | ||
|
||
import dotty.dokka._ | ||
|
||
trait NameNormalizer { self: TastyParser => | ||
import qctx.reflect._ | ||
extension (s: Symbol) def normalizedName: String = { | ||
val withoutGivenPrefix = if s.isGiven then s.name.stripPrefix("given_") else s.name | ||
val withoutObjectSuffix = if s.flags.is(Flags.Object) then withoutGivenPrefix.stripSuffix("$") else withoutGivenPrefix | ||
val constructorNormalizedName = if s.isClassConstructor then "this" else withoutObjectSuffix | ||
constructorNormalizedName | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -248,6 +248,14 @@ class ScalaPageContentBuilder( | |
|
||
def signature(d: Documentable) = addChildren(signatureProvider.signature(d).asScala.toList) | ||
|
||
private def buildSignature(d: Documentable, s: Signature) = signatureProvider.asInstanceOf[ScalaSignatureProvider].signature(d, s) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we can move There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We are using contentBuilder field from ScalaSignatureProvider class which will be hard to obtain in object |
||
|
||
def signature(d: Documentable, s: Signature) = addChild(buildSignature(d, s)) | ||
|
||
def inlineSignature(d: Documentable, s: Signature) = addChildren( | ||
buildSignature(d, s).getChildren.asScala.toSeq | ||
) | ||
|
||
def defaultHeaders = List( | ||
contentForDRIs( | ||
dris = mainDRI, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch!