Skip to content

Commit 0a1aed2

Browse files
authored
Merge pull request #5464 from Glavo/master
Fix #5463: Replace the call to the String#lines method
2 parents 36281b3 + 53b4844 commit 0a1aed2

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

compiler/src/dotty/tools/dotc/util/ParsedComment.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ object ParsedComment {
148148
* @return The list of items, in markdown.
149149
*/
150150
private def toMarkdownList(ctx: Context, items: List[String]): String = {
151-
val formattedItems = items.map(_.lines.mkString(System.lineSeparator + " "))
151+
val formattedItems = items.map(_.linesIterator.mkString(System.lineSeparator + " "))
152152
formattedItems.mkString(" - ", System.lineSeparator + " - ", "")
153153
}
154154

tests/disabled/partest/run/t6240-universe-code-gen.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ object Test extends dotty.runtime.LegacyApp {
6565
val actualFile = new java.io.File(testFile.getParent + "/../../../src/reflect/scala/reflect/runtime/JavaUniverseForce.scala").getCanonicalFile
6666
val actual = scala.io.Source.fromFile(actualFile)
6767
val actualLines = actual.getLines.toList
68-
val generatedLines = code.lines.toList
68+
val generatedLines = code.linesIterator.toList
6969
if (actualLines != generatedLines) {
7070
val msg = s"""|${actualFile} must be updated.
7171
|===========================================================

tests/disabled/reflect/run/t8549.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ object Test extends dotty.runtime.LegacyApp {
2828
def patch(file: File, line: Int, prevResult: String, result: String): Unit = {
2929
amend(file) {
3030
content =>
31-
content.lines.toList.zipWithIndex.map {
31+
content.linesIterator.toList.zipWithIndex.map {
3232
case (content, i) if i == line - 1 =>
3333
val newContent = content.replaceAllLiterally(quote(prevResult), quote(result))
3434
if (newContent != content)
@@ -48,7 +48,7 @@ object Test extends dotty.runtime.LegacyApp {
4848
val newComment = s" // Generated on $timestamp with Scala ${scala.util.Properties.versionString})"
4949
amend(file) {
5050
content =>
51-
content.lines.toList.map {
51+
content.linesIterator.toList.map {
5252
f => f.replaceAll("""^ +// Generated on.*""", newComment)
5353
}.mkString("\n")
5454
}

0 commit comments

Comments
 (0)