diff options
-rw-r--r-- | src/library/scala/runtime/SeqCharSequence.scala | 7 | ||||
-rw-r--r-- | test/scaladoc/run/t8314.check | 3 | ||||
-rw-r--r-- | test/scaladoc/run/t8314.scala | 16 |
3 files changed, 25 insertions, 1 deletions
diff --git a/src/library/scala/runtime/SeqCharSequence.scala b/src/library/scala/runtime/SeqCharSequence.scala index d2084a6598..a7765994ec 100644 --- a/src/library/scala/runtime/SeqCharSequence.scala +++ b/src/library/scala/runtime/SeqCharSequence.scala @@ -41,5 +41,10 @@ final class ArrayCharSequence(val xs: Array[Char], start: Int, end: Int) extends new ArrayCharSequence(xs, start1, start1 + newlen) } } - override def toString = xs drop start take length mkString "" + override def toString = { + val start = math.max(this.start, 0) + val end = math.min(xs.length, start + length) + + if (start >= end) "" else new String(xs, start, end - start) + } } diff --git a/test/scaladoc/run/t8314.check b/test/scaladoc/run/t8314.check new file mode 100644 index 0000000000..aa04c12c8f --- /dev/null +++ b/test/scaladoc/run/t8314.check @@ -0,0 +1,3 @@ +Body(List(Paragraph(Chain(List(Summary(Chain(List(Text(This should be ), Monospace(Text(monospaced)))))))))) + +Done. diff --git a/test/scaladoc/run/t8314.scala b/test/scaladoc/run/t8314.scala new file mode 100644 index 0000000000..7f6d6fdb00 --- /dev/null +++ b/test/scaladoc/run/t8314.scala @@ -0,0 +1,16 @@ +import scala.tools.nsc.doc.model._ +import scala.tools.partest.ScaladocModelTest + +object Test extends ScaladocModelTest { + override def code = """ + /** This should be `monospaced` */ + class A + """ + + def scaladocSettings = "" + + def testModel(root: Package) = { + import access._ + root._class("A").comment foreach println + } +} |