diff options
-rwxr-xr-x | src/compiler/scala/tools/nsc/ast/DocComments.scala | 19 | ||||
-rw-r--r-- | test/scaladoc/resources/Trac4409.scala | 14 | ||||
-rw-r--r-- | test/scaladoc/scala/html/HtmlFactoryTest.scala | 9 |
3 files changed, 30 insertions, 12 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/DocComments.scala b/src/compiler/scala/tools/nsc/ast/DocComments.scala index 9764e92cde..2e97a3d820 100755 --- a/src/compiler/scala/tools/nsc/ast/DocComments.scala +++ b/src/compiler/scala/tools/nsc/ast/DocComments.scala @@ -296,18 +296,13 @@ trait DocComments { self: SymbolTable => * useCases: all usecase sections (as instances of class UseCase) */ lazy val (template, defines, useCases) = { - val sections = tagIndex(raw, idx => - startsWithTag(raw, idx, "@define") || startsWithTag(raw, idx, "@usecase")) - val (defines, usecases) = sections partition (startsWithTag(raw, _, "@define")) - val end = startTag(raw, sections) - /* - println("processing doc comment:") - println(raw) - println("===========>") - println(raw.substring(0, end)) - println("++++++++++++++++") - println(sections map { case (s, e) => raw.substring(s, e) }) - */ + val sections = tagIndex(raw) + + val defines = sections filter { startsWithTag(raw, _, "@define") } + val usecases = sections filter { startsWithTag(raw, _, "@usecase") } + + val end = startTag(raw, (defines ::: usecases).sort(_._1 < _._1)) + (if (end == raw.length - 2) raw else raw.substring(0, end) + "*/", defines map { case (start, end) => raw.substring(start, end) }, usecases map { case (start, end) => decomposeUseCase(start, end) }) diff --git a/test/scaladoc/resources/Trac4409.scala b/test/scaladoc/resources/Trac4409.scala new file mode 100644 index 0000000000..f93d3e238e --- /dev/null +++ b/test/scaladoc/resources/Trac4409.scala @@ -0,0 +1,14 @@ +/** + * @define xxx + * + * The value of xxx don't contain since tag. + * + * @since 1.0 + */ + +class Trac4409 { + /** + * $xxx + */ + def foo = 123 +} diff --git a/test/scaladoc/scala/html/HtmlFactoryTest.scala b/test/scaladoc/scala/html/HtmlFactoryTest.scala index c0cd55a7e7..6b599693da 100644 --- a/test/scaladoc/scala/html/HtmlFactoryTest.scala +++ b/test/scaladoc/scala/html/HtmlFactoryTest.scala @@ -257,4 +257,13 @@ object Test extends Properties("HtmlFactory") { case _ => false } } + + property("Trac #4409") = { + createTemplate("Trac4409.scala") match { + case node: scala.xml.Node => { + ! node.toString.contains("""<div class="block"><ol>since""") + } + case _ => false + } + } } |