Skip to content

Conversation

fdietze
Copy link

@fdietze fdietze commented Aug 11, 2017

I picked up an old 2.12 branch and just compiled with 2.12.3. When I run

sbt ++2.12.3 test

There is exactly one failing test:

...
[info] Test scalaxy.streams.test.SideEffectsTest.collections started
SideEffect(scala.runtime.ScalaRunTime,Reference to scala.runtime.ScalaRunTime,Unsafe)
[error] Test scalaxy.streams.test.SideEffectsTest.collections failed: Array(Array(1)).zipWithIndex.withFilter(((check$ifrefutable$1) => check$ifrefutable$1: @scala.unchecked match {
[error]   case scala.Tuple2((a @ _), (i @ _)) => true
[error]   case _ => false
[error] })).withFilter(((check$ifrefutable$2) => check$ifrefutable$2: @scala.unchecked match {
[error]   case (x$2 @ scala.Tuple2((a @ _), (i @ _))) => true
[error]   case _ => false
[error] })).map(((x$3) => x$3: @scala.unchecked match {
[error]   case (x$2 @ scala.Tuple2((a @ _), (i @ _))) => {
[error]     val len = a.length;
[error]     scala.Tuple2(x$2, len)
[error]   }
[error] })).withFilter(((x$4) => x$4: @scala.unchecked match {
[error]   case scala.Tuple2((x$2 @ scala.Tuple2((a @ _), (i @ _))), (len @ _)) => len.$less(i)
[error] })).map(((x$5) => x$5: @scala.unchecked match {
[error]   case scala.Tuple2((x$2 @ scala.Tuple2((a @ _), (i @ _))), (len @ _)) => a.$plus(", ").$plus(len).$plus(", ").$plus(i)
[error] })) expected:<List()> but was:<List(Unsafe)>, took 0.396 sec
[info] Test run finished: 1 failed, 0 ignored, 7 total, 1.864s
...
[error] Failed: Total 449, Failed 1, Errors 0, Passed 416, Skipped 32
[error] Failed tests:
[error] 	scalaxy.streams.test.SideEffectsTest
[error] (test:test) sbt.TestsFailedException: Tests unsuccessful
[error] Total time: 171 s, completed Aug 11, 2017 4:33:28 PM

I don't understand what this is about. Need to investigate further. Any help is appreciated.

@fdietze
Copy link
Author

fdietze commented Oct 4, 2018

The problematic test is:

    expectSideEffectSeverities(List(),
      q"""
        for ((a, i) <- Array(Array(1)).zipWithIndex; len = a.length; if len < i) yield {
          a + ", " + len + ", " + i
        }
      """)
[error] })) expected:<List()> but was:<List(Unsafe)>, took 0.396 sec

It is expected to be not Unsafe, but it returns Unsafe. So the optimizer thinks a piece of code is unsafe even though it actually would be safe to optimize. So I think it will not do anything bad.

All other tests are running successfully. Travis only fails because it cannot deploy a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant