Skip to content

Commit acd0c6e

Browse files
authored
Merge pull request #4573 from dotty-staging/fix/dottydoc-package-doc
Dottydoc: Keep documentation on package objects
2 parents 3c3130d + 95b3fb9 commit acd0c6e

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

doc-tool/src/dotty/tools/dottydoc/DocCompiler.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ class DocCompiler extends Compiler {
3030
List(new DocImplicitsPhase) ::
3131
List(new DocASTPhase) ::
3232
List(DocMiniTransformations(new UsecasePhase,
33-
new DocstringPhase,
34-
new PackageObjectsPhase,
33+
new DocstringPhase)) ::
34+
List(DocMiniTransformations(new PackageObjectsPhase,
3535
new LinkReturnTypes,
3636
new LinkParamListTypes,
3737
new LinkImplicitlyAddedTypes,

doc-tool/test/SimpleComments.scala

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,17 @@ class TestSimpleComments extends DottyDocTest {
4949
assertEquals(traitCmt, "<p>Hello, world!</p>")
5050
}
5151
}
52+
53+
@Test def commentOnPackageObject = {
54+
val source =
55+
"""
56+
|/** Hello, world! */
57+
|package object foobar { class A }
58+
""".stripMargin
59+
60+
checkSource(source) { packages =>
61+
val packageCmt = packages("foobar").comment.get.body
62+
assertEquals("<p>Hello, world!</p>", packageCmt)
63+
}
64+
}
5265
}

0 commit comments

Comments
 (0)