From 9781aba3e538ca933dcc15039bf6df8c5ffeee35 Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Fri, 1 Apr 2011 06:41:46 +0000 Subject: Fix for parsing bug in scaladoc closes #4420, n... Fix for parsing bug in scaladoc closes #4420, no review. --- src/compiler/scala/tools/nsc/ast/DocComments.scala | 6 +----- test/scaladoc/resources/Trac4420.scala | 14 ++++++++++++++ test/scaladoc/scala/html/HtmlFactoryTest.scala | 12 ++++++++++++ 3 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 test/scaladoc/resources/Trac4420.scala diff --git a/src/compiler/scala/tools/nsc/ast/DocComments.scala b/src/compiler/scala/tools/nsc/ast/DocComments.scala index 13167bf586..51c1fab0f1 100755 --- a/src/compiler/scala/tools/nsc/ast/DocComments.scala +++ b/src/compiler/scala/tools/nsc/ast/DocComments.scala @@ -337,12 +337,8 @@ trait DocComments { self: SymbolTable => var idx = skipVariable(str, start) val vble = variableName(str.substring(start, idx)) - if (idx < str.length && isWhitespace(str charAt idx)) idx += 1 - var end = str.lastIndexOf('\n') - if (end == -1) end = str.length - defs(sym) += vble -> str.substring(idx, end) + defs(sym) += vble -> (str drop idx).trim.replaceAll("""\s+\*+$""", "") } - //if (defs(sym).nonEmpty) println("vars of "+sym+" = "+defs(sym)) // !!! } } diff --git a/test/scaladoc/resources/Trac4420.scala b/test/scaladoc/resources/Trac4420.scala new file mode 100644 index 0000000000..dbe053f3da --- /dev/null +++ b/test/scaladoc/resources/Trac4420.scala @@ -0,0 +1,14 @@ +import java.io.File + +/** + * @define PP This class is an instance of XXX so it's members are not called directly. + * Instead these classes are instantiated via a driver's ''process''. See YYY for more details. */ +abstract class test + +/** + * TestA class + * + * this is a description. + * + * $PP */ +class TestA extends test diff --git a/test/scaladoc/scala/html/HtmlFactoryTest.scala b/test/scaladoc/scala/html/HtmlFactoryTest.scala index 738f459157..651a384dbf 100644 --- a/test/scaladoc/scala/html/HtmlFactoryTest.scala +++ b/test/scaladoc/scala/html/HtmlFactoryTest.scala @@ -212,6 +212,18 @@ object Test extends Properties("HtmlFactory") { } } + property("Trac #4420 - no whitespace at end of line") = { + val files = createTemplates("Trac4420.scala") + + files("TestA.html") match { + case node: scala.xml.Node => { + val s = node.toString + s.contains("""See YYY for more details""") + } + case _ => false + } + } + property("Trac #484 - refinements and existentials") = { val files = createTemplates("Trac484.scala") val lines = """ -- cgit v1.2.3