We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
object SpanBug extends App { def test(thunk: => Boolean, m: String): Unit = if(!thunk) throw new RuntimeException(m) val (tLeft, tRight) = Iterator(1,2,3).span(_ => true) test(tRight.hasNext == false, "tRight.hasNext shouldBe false") test(tLeft.hasNext == true, "tLeft.hasNext shouldBe true") }
this problem is not occurred in scala 2.11.7. when call tRight.hasNext before tLeft.hasNext, tLeft.hasNext returns unexpected value.
The text was updated successfully, but these errors were encountered:
Imported From: https://issues.scala-lang.org/browse/SI-9913?orig=1 Reporter: seraph (seraphr) Affected Versions: 2.11.8, 2.12.0-M5
Sorry, something went wrong.
@som-snytt said (edited on Sep 6, 2016 5:25:59 AM UTC):
$ scala Welcome to Scala 2.11.8 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_92). Type in expressions for evaluation. Or try :help. scala> { val (l,r) = Iterator(1,2,3).span(_ => true) ; l.hasNext && !r.hasNext } res0: Boolean = true scala> { val (l,r) = Iterator(1,2,3).span(_ => true) ; !r.hasNext && l.hasNext } res1: Boolean = false scala> val (l,r) = Iterator(1,2,3).span(_ => true) l: Iterator[Int] = non-empty iterator r: Iterator[Int] = unknown-if-empty iterator scala> !r.hasNext && l.hasNext res2: Boolean = true scala> { val (l,r) = Iterator(1,2,3).span(_ => true) ; l.hasNext ; assert(!r.hasNext) ; l.toList } res3: List[Int] = List(1)
@som-snytt said: scala/scala#5378
som-snytt
No branches or pull requests
example code
this problem is not occurred in scala 2.11.7.
when call tRight.hasNext before tLeft.hasNext, tLeft.hasNext returns unexpected value.
steps to reproduce:
The text was updated successfully, but these errors were encountered: