diff options
author | Som Snytt <som.snytt@gmail.com> | 2014-05-27 12:55:13 -0700 |
---|---|---|
committer | Som Snytt <som.snytt@gmail.com> | 2014-05-27 15:03:53 -0700 |
commit | 5277fb4d69714b52a9c43fd6ac439e6d16d7a3e9 (patch) | |
tree | bc224c86f822f7e3b4c104be3f623ae36167a330 /src | |
parent | 5551cf66e5b27ae398b527df6fe4247aed1ff307 (diff) | |
download | scala-5277fb4d69714b52a9c43fd6ac439e6d16d7a3e9.tar.gz scala-5277fb4d69714b52a9c43fd6ac439e6d16d7a3e9.tar.bz2 scala-5277fb4d69714b52a9c43fd6ac439e6d16d7a3e9.zip |
SI-8630 lineToString no longer long by one at eof
One more EOL crasher, or lack-of-EOL crasher, when the text
is at EOF.
It was not caught by the last round of excellent and
thorough tests because
```
// If non-whitespace tokens run all the way up to EOF,
// positions go wrong because the correct end of the last
// token cannot be used as an index into the char array.
// The least painful way to address this was to add a
// newline to the array.
```
Diffstat (limited to 'src')
-rw-r--r-- | src/reflect/scala/reflect/internal/util/SourceFile.scala | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/reflect/scala/reflect/internal/util/SourceFile.scala b/src/reflect/scala/reflect/internal/util/SourceFile.scala index 4fccad74ac..a2642628a4 100644 --- a/src/reflect/scala/reflect/internal/util/SourceFile.scala +++ b/src/reflect/scala/reflect/internal/util/SourceFile.scala @@ -40,7 +40,7 @@ abstract class SourceFile { def lineToString(index: Int): String = { val start = lineToOffset(index) var end = start - while (!isEndOfLine(end) && end <= length) end += 1 + while (end < length && !isEndOfLine(end)) end += 1 new String(content, start, end - start) } |