diff options
-rw-r--r-- | compiler/src/dotty/tools/dotc/transform/IsInstanceOfEvaluator.scala | 1 | ||||
-rw-r--r-- | doc-tool/src/dotty/tools/dottydoc/core/DocstringPhase.scala | 16 |
2 files changed, 15 insertions, 2 deletions
diff --git a/compiler/src/dotty/tools/dotc/transform/IsInstanceOfEvaluator.scala b/compiler/src/dotty/tools/dotc/transform/IsInstanceOfEvaluator.scala index 0c6ee7a18..ebd2ae436 100644 --- a/compiler/src/dotty/tools/dotc/transform/IsInstanceOfEvaluator.scala +++ b/compiler/src/dotty/tools/dotc/transform/IsInstanceOfEvaluator.scala @@ -33,7 +33,6 @@ class IsInstanceOfEvaluator extends MiniPhaseTransform { thisTransformer => import dotty.tools.dotc.ast.tpd._ - /** @inheritdoc */ val phaseName = "isInstanceOfEvaluator" /** Transforms a [TypeApply](dotty.tools.dotc.ast.Trees.TypeApply) in order to diff --git a/doc-tool/src/dotty/tools/dottydoc/core/DocstringPhase.scala b/doc-tool/src/dotty/tools/dottydoc/core/DocstringPhase.scala index 9c962ded4..55f2a05ba 100644 --- a/doc-tool/src/dotty/tools/dottydoc/core/DocstringPhase.scala +++ b/doc-tool/src/dotty/tools/dottydoc/core/DocstringPhase.scala @@ -3,6 +3,8 @@ package dottydoc package core import dotc.core.Contexts.Context +import dotc.core.Symbols.Symbol +import dotc.core.Comments.{ Comment => CompilerComment } import transform.DocMiniPhase import model._ import model.internal._ @@ -12,8 +14,20 @@ import util.syntax._ /** Phase to add docstrings to the Dottydoc AST */ class DocstringPhase extends DocMiniPhase with CommentParser with CommentCleaner { + private def getComment(sym: Symbol)(implicit ctx: Context): Option[CompilerComment] = + ctx.docbase.docstring(sym) + .orElse { + // If the symbol doesn't have a docstring, look for an overridden + // ancestor with a docstring + sym.allOverriddenSymbols.collectFirst { + case parentSym if ctx.docbase.docstring(parentSym).isDefined => + parentSym + } + .flatMap(ctx.docbase.docstring) + } + private def parsedComment(ent: Entity)(implicit ctx: Context): Option[Comment] = - ctx.docbase.docstring(ent.symbol).map { cmt => + getComment(ent.symbol).map { cmt => val parsed = parse(ent, ctx.docbase.packages, clean(cmt.raw), cmt.raw, cmt.pos) if (ctx.settings.wikiSyntax.value) |