Skip to content

Commit

Permalink
Fix #5463: Replace the call to the lines method with linesIterator
Browse files Browse the repository at this point in the history
  • Loading branch information
Glavo committed Nov 19, 2018
1 parent 36281b3 commit 53b4844
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/util/ParsedComment.scala
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ object ParsedComment {
* @return The list of items, in markdown.
*/
private def toMarkdownList(ctx: Context, items: List[String]): String = {
val formattedItems = items.map(_.lines.mkString(System.lineSeparator + " "))
val formattedItems = items.map(_.linesIterator.mkString(System.lineSeparator + " "))
formattedItems.mkString(" - ", System.lineSeparator + " - ", "")
}

Expand Down
2 changes: 1 addition & 1 deletion tests/disabled/partest/run/t6240-universe-code-gen.scala
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ object Test extends dotty.runtime.LegacyApp {
val actualFile = new java.io.File(testFile.getParent + "/../../../src/reflect/scala/reflect/runtime/JavaUniverseForce.scala").getCanonicalFile
val actual = scala.io.Source.fromFile(actualFile)
val actualLines = actual.getLines.toList
val generatedLines = code.lines.toList
val generatedLines = code.linesIterator.toList
if (actualLines != generatedLines) {
val msg = s"""|${actualFile} must be updated.
|===========================================================
Expand Down
4 changes: 2 additions & 2 deletions tests/disabled/reflect/run/t8549.scala
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ object Test extends dotty.runtime.LegacyApp {
def patch(file: File, line: Int, prevResult: String, result: String): Unit = {
amend(file) {
content =>
content.lines.toList.zipWithIndex.map {
content.linesIterator.toList.zipWithIndex.map {
case (content, i) if i == line - 1 =>
val newContent = content.replaceAllLiterally(quote(prevResult), quote(result))
if (newContent != content)
Expand All @@ -48,7 +48,7 @@ object Test extends dotty.runtime.LegacyApp {
val newComment = s" // Generated on $timestamp with Scala ${scala.util.Properties.versionString})"
amend(file) {
content =>
content.lines.toList.map {
content.linesIterator.toList.map {
f => f.replaceAll("""^ +// Generated on.*""", newComment)
}.mkString("\n")
}
Expand Down

0 comments on commit 53b4844

Please sign in to comment.