diff options
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/scala/StringContext.scala | 13 | ||||
-rw-r--r-- | src/library/scala/collection/SeqLike.scala | 2 | ||||
-rw-r--r-- | src/library/scala/util/Random.scala | 2 |
3 files changed, 9 insertions, 8 deletions
diff --git a/src/library/scala/StringContext.scala b/src/library/scala/StringContext.scala index 8be0cb1619..1b5fd6c8d3 100644 --- a/src/library/scala/StringContext.scala +++ b/src/library/scala/StringContext.scala @@ -100,8 +100,8 @@ case class StringContext(parts: String*) { * ''Note:'' Even when using the raw interpolator, Scala will preprocess unicode escapes. * For example: * {{{ - * scala> raw"\u0123" - * res0: String = ģ + * scala> raw"\u005cu0025" + * res0: String = # * }}} * * @param `args` The arguments to be inserted into the resulting string. @@ -191,7 +191,7 @@ object StringContext { var cur = 0 var idx = 0 def output(ch: Char) = { - bldr append str.substring (start, cur) + bldr.append(str, start, cur) bldr append ch start = idx } @@ -199,14 +199,15 @@ object StringContext { cur = idx if (str(idx) == '\\') { idx += 1 + if (idx >= len) throw new InvalidEscapeException(str, cur) if ('0' <= str(idx) && str(idx) <= '7') { val leadch = str(idx) var oct = leadch - '0' idx += 1 - if ('0' <= str(idx) && str(idx) <= '7') { + if (idx < len && '0' <= str(idx) && str(idx) <= '7') { oct = oct * 8 + str(idx) - '0' idx += 1 - if (leadch <= '3' && '0' <= str(idx) && str(idx) <= '7') { + if (idx < len && leadch <= '3' && '0' <= str(idx) && str(idx) <= '7') { oct = oct * 8 + str(idx) - '0' idx += 1 } @@ -234,6 +235,6 @@ object StringContext { } } if (start == 0) str - else (bldr append str.substring(start, idx)).toString + else bldr.append(str, start, idx).toString } } diff --git a/src/library/scala/collection/SeqLike.scala b/src/library/scala/collection/SeqLike.scala index 6871a3cb73..f65e2ef9cd 100644 --- a/src/library/scala/collection/SeqLike.scala +++ b/src/library/scala/collection/SeqLike.scala @@ -22,7 +22,7 @@ import scala.math.{ min, max, Ordering } * Sequences are special cases of iterable collections of class `Iterable`. * Unlike iterables, sequences always have a defined order of elements. * Sequences provide a method `apply` for indexing. Indices range from `0` up to the `length` of - * a sequence. Sequences support a number to find occurrences of elements or subsequences, including + * a sequence. Sequences support a number of methods to find occurrences of elements or subsequences, including * `segmentLength`, `prefixLength`, `indexWhere`, `indexOf`, `lastIndexWhere`, `lastIndexOf`, * `startsWith`, `endsWith`, `indexOfSlice`. * diff --git a/src/library/scala/util/Random.scala b/src/library/scala/util/Random.scala index 24c4cd7a32..2b11594f66 100644 --- a/src/library/scala/util/Random.scala +++ b/src/library/scala/util/Random.scala @@ -17,7 +17,7 @@ import scala.language.{implicitConversions, higherKinds} * @author Stephane Micheloud * */ -class Random(val self: java.util.Random) { +class Random(val self: java.util.Random) extends AnyRef with Serializable { /** Creates a new random number generator using a single long seed. */ def this(seed: Long) = this(new java.util.Random(seed)) |