From 53b48445e3da8cc203f311ac42d646d181f4bc27 Mon Sep 17 00:00:00 2001 From: Glavo Date: Mon, 19 Nov 2018 18:59:43 +0800 Subject: [PATCH] Fix #5463: Replace the call to the `lines` method with `linesIterator` --- compiler/src/dotty/tools/dotc/util/ParsedComment.scala | 2 +- tests/disabled/partest/run/t6240-universe-code-gen.scala | 2 +- tests/disabled/reflect/run/t8549.scala | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/util/ParsedComment.scala b/compiler/src/dotty/tools/dotc/util/ParsedComment.scala index 98cff1a325d1..ebed92570fbb 100644 --- a/compiler/src/dotty/tools/dotc/util/ParsedComment.scala +++ b/compiler/src/dotty/tools/dotc/util/ParsedComment.scala @@ -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 + " - ", "") } diff --git a/tests/disabled/partest/run/t6240-universe-code-gen.scala b/tests/disabled/partest/run/t6240-universe-code-gen.scala index 4a213c39df08..09d917a448df 100644 --- a/tests/disabled/partest/run/t6240-universe-code-gen.scala +++ b/tests/disabled/partest/run/t6240-universe-code-gen.scala @@ -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. |=========================================================== diff --git a/tests/disabled/reflect/run/t8549.scala b/tests/disabled/reflect/run/t8549.scala index c124d99bca69..f30841174d50 100644 --- a/tests/disabled/reflect/run/t8549.scala +++ b/tests/disabled/reflect/run/t8549.scala @@ -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) @@ -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") }