summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/scaladoc/scala/tools/nsc/doc/base/CommentFactoryBase.scala12
-rw-r--r--test/scaladoc/run/t8672.check4
-rw-r--r--test/scaladoc/run/t8672.scala32
3 files changed, 47 insertions, 1 deletions
diff --git a/src/scaladoc/scala/tools/nsc/doc/base/CommentFactoryBase.scala b/src/scaladoc/scala/tools/nsc/doc/base/CommentFactoryBase.scala
index a933c35c99..19cc27b40b 100755
--- a/src/scaladoc/scala/tools/nsc/doc/base/CommentFactoryBase.scala
+++ b/src/scaladoc/scala/tools/nsc/doc/base/CommentFactoryBase.scala
@@ -666,7 +666,7 @@ trait CommentFactoryBase { this: MemberLookupBase =>
}
def summary(): Inline = {
- val i = inline(check("."))
+ val i = inline(checkSentenceEnded())
Summary(
if (jump("."))
Chain(List(i, Text(".")))
@@ -785,6 +785,16 @@ trait CommentFactoryBase { this: MemberLookupBase =>
})
}
+ def checkSentenceEnded(): Boolean = {
+ (char == '.') && {
+ val poff = offset
+ nextChar() // read '.'
+ val ok = char == endOfText || char == endOfLine || isWhitespace(char)
+ offset = poff
+ ok
+ }
+ }
+
def reportError(pos: Position, message: String) {
reporter.warning(pos, message)
}
diff --git a/test/scaladoc/run/t8672.check b/test/scaladoc/run/t8672.check
new file mode 100644
index 0000000000..d7194c73bf
--- /dev/null
+++ b/test/scaladoc/run/t8672.check
@@ -0,0 +1,4 @@
+Some(Chain(List(Text(New in release 1.2.3.4, it works), Text(.))))
+Some(Text(Sentence no period))
+Some(Chain(List(Text(Sentence period at end), Text(.))))
+Done.
diff --git a/test/scaladoc/run/t8672.scala b/test/scaladoc/run/t8672.scala
new file mode 100644
index 0000000000..8a9b5086bd
--- /dev/null
+++ b/test/scaladoc/run/t8672.scala
@@ -0,0 +1,32 @@
+import scala.tools.nsc.doc.model._
+import scala.tools.partest.ScaladocModelTest
+
+object Test extends ScaladocModelTest {
+ override def code = """
+ class C {
+
+ /**
+ * New in release 1.2.3.4, it works. Next sentence.
+ * Next Line.
+ */
+ def method1 = 0
+
+ /** Sentence no period */
+ def method2 = 0
+
+ /** Sentence period at end.*/
+ def method3 = 0
+ }
+ """
+
+ def scaladocSettings = ""
+
+ def testModel(root: Package) = {
+ import access._
+ val ms = List("method1", "method2", "method3")
+ for (m <- ms) {
+ val method = root._class("C")._method(m)
+ println(method.comment.get.body.summary)
+ }
+ }
+}