You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Scala2.9 REPL scala.io.Source
It becomes a false result if it divides into two lines when it is one line though it is correct.
//OK
scala> val s = scala.io.Source.fromFile("C:/a.txt"); val r = s.getLines.toList
s: scala.io.BufferedSource = empty iterator
r: List[String] = List(aaa, aa)
//NG
scala> val s = scala.io.Source.fromFile("C:/a.txt")
s: scala.io.BufferedSource = non-empty iterator
scala> val r = s.getLines.toList
r: List[String] = List()
Scala2.8.1 is OK.
The text was updated successfully, but these errors were encountered:
For your information, the problem is that REPL printed the iterator s, which makes getLines return empty. Work-around: don't print a BufferedSource before calling getLines on it.
Commit Message Bot (anonymous) said:
(extempore in r25212) Keep BufferedSource from losing buffered data when a derivative iterator
is created via getLines. Closes #4671, #4662, no review.
Scala2.9 REPL scala.io.Source
It becomes a false result if it divides into two lines when it is one line though it is correct.
//OK
scala> val s = scala.io.Source.fromFile("C:/a.txt"); val r = s.getLines.toList
s: scala.io.BufferedSource = empty iterator
r: List[String] = List(aaa, aa)
//NG
scala> val s = scala.io.Source.fromFile("C:/a.txt")
s: scala.io.BufferedSource = non-empty iterator
scala> val r = s.getLines.toList
r: List[String] = List()
Scala2.8.1 is OK.
The text was updated successfully, but these errors were encountered: