Skip to content

Commit 79c17ae

Browse files
committed
Make sure TypeAliases get proper docstrings and linked aliases
1 parent cf068d4 commit 79c17ae

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

doc-tool/resources/_layouts/api-page.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
<span id="entity-name">
2323
{{ entity.name }}
2424
</span>
25+
{% if entity.typeParams.size > 0 %}
2526
<span id="entity-type-params">
2627
<span class="no-left">[</span>
2728
{% for param in entity.typeParams %}
@@ -35,6 +36,7 @@
3536
{% endfor %}
3637
<span class="no-left">]</span>
3738
</span>
39+
{% endif %}
3840
{% if entity.superTypes.size > 0 %}
3941
<div id="super-types">
4042
{% for super in entity.superTypes %}

doc-tool/src/dotty/tools/dottydoc/core/DocstringPhase.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,8 @@ class DocstringPhase extends DocMiniPhase with CommentParser with CommentCleaner
6363
override def transformVal(implicit ctx: Context) = { case ent: ValImpl =>
6464
ent.copy(comment = parsedComment(ent))
6565
}
66+
67+
override def transformTypeAlias(implicit ctx: Context) = { case ent: TypeAliasImpl =>
68+
ent.copy(comment = parsedComment(ent))
69+
}
6670
}

doc-tool/src/dotty/tools/dottydoc/core/TypeLinkingPhases.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ class LinkReturnTypes extends DocMiniPhase with TypeLinker {
2626
val returnValue = linkReference(vl, vl.returnValue, ctx.docbase.packages)
2727
vl.copy(returnValue = returnValue)
2828
}
29+
30+
override def transformTypeAlias(implicit ctx: Context) = { case ta: TypeAliasImpl =>
31+
ta.alias.map { alias =>
32+
val linkedAlias = linkReference(ta, alias, ctx.docbase.packages)
33+
ta.copy(alias = Some(linkedAlias))
34+
}
35+
.getOrElse(ta)
36+
}
2937
}
3038

3139
class LinkParamListTypes extends DocMiniPhase with TypeLinker {

0 commit comments

Comments
 (0)