diff options
-rwxr-xr-x | src/compiler/scala/tools/nsc/ast/DocComments.scala | 4 | ||||
-rw-r--r-- | test/scaladoc/resources/Trac4289.scala | 13 | ||||
-rw-r--r-- | test/scaladoc/scala/html/HtmlFactoryTest.scala | 13 |
3 files changed, 29 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/DocComments.scala b/src/compiler/scala/tools/nsc/ast/DocComments.scala index 51c1fab0f1..9764e92cde 100755 --- a/src/compiler/scala/tools/nsc/ast/DocComments.scala +++ b/src/compiler/scala/tools/nsc/ast/DocComments.scala @@ -178,10 +178,12 @@ trait DocComments { self: SymbolTable => if (end > tocopy) tocopy = end case None => srcSec match { - case Some((start1, end1)) => + case Some((start1, end1)) => { out append dst.substring(copied, tocopy).trim + out append "\n" copied = tocopy out append src.substring(start1, end1).trim + } case None => } } diff --git a/test/scaladoc/resources/Trac4289.scala b/test/scaladoc/resources/Trac4289.scala new file mode 100644 index 0000000000..1644e18bd4 --- /dev/null +++ b/test/scaladoc/resources/Trac4289.scala @@ -0,0 +1,13 @@ +class Superclass { + /** + * @return 123 + */ + def foo = 123 +} + +class Subclass extends Superclass { + /** + * hello + */ + override def foo = 456 +} diff --git a/test/scaladoc/scala/html/HtmlFactoryTest.scala b/test/scaladoc/scala/html/HtmlFactoryTest.scala index 651a384dbf..c0cd55a7e7 100644 --- a/test/scaladoc/scala/html/HtmlFactoryTest.scala +++ b/test/scaladoc/scala/html/HtmlFactoryTest.scala @@ -244,4 +244,17 @@ object Test extends Properties("HtmlFactory") { case _ => false } } + + property("Trac #4289") = { + val files = createTemplates("Trac4289.scala") + + files("Subclass.html") match { + case node: scala.xml.Node => { + node.toString.contains { + """<dt>returns</dt><dd class="cmt"><p>123</p></dd>""" + } + } + case _ => false + } + } } |