Skip to content

Commit 994154f

Browse files
committed
work around scala/bug#11152 in a 2.13 friendly way
I forgot .linesIterator was removed entirely in 2.13 and won't return until 2.13.0-RC1
1 parent 1bcf341 commit 994154f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

fnGen/WrapFnGen.scala

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,14 @@ object WrapFnGen {
5858
}
5959

6060
implicit class SplitMyLinesAndStuff(s: String) {
61-
def toVec = s.linesIterator.toVector
61+
// work around scala/bug#11125
62+
def toVec = Predef.augmentString(s).lines.toVector
6263
def nonBlank = s.trim.length > 0
6364
}
6465

6566
implicit class TreeToText(t: Tree) {
66-
def text = showCode(t).replace("$", "").linesIterator.toVector
67+
// work around scala/bug#11125
68+
def text = Predef.augmentString(showCode(t).replace("$", "")).lines.toVector
6769
}
6870

6971
case class Prioritized(lines: Vector[String], priority: Int) {
@@ -288,7 +290,8 @@ object WrapFnGen {
288290
def sameText(f: java.io.File, text: String): Boolean = {
289291
val x = scala.io.Source.fromFile(f)
290292
val lines = try { x.getLines.toVector } finally { x.close }
291-
lines.iterator.filter(_.nonBlank) == text.linesIterator.filter(_.nonBlank)
293+
// work around scala/bug#11125
294+
lines.iterator.filter(_.nonBlank) == Predef.augmentString(text).lines.filter(_.nonBlank)
292295
}
293296

294297
def write(f: java.io.File, text: String): Unit = {

0 commit comments

Comments
 (0)