Skip to content
New issue

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

Future.fallbackTo does not preserve first Future's Failure per documentation #6913

Closed
scabug opened this issue Jan 4, 2013 · 3 comments
Closed
Labels
Milestone

Comments

@scabug
Copy link

scabug commented Jan 4, 2013

scala.concurrent.Future fallbackTo method is documented as returning the failure of the first future if both futures fail, but instead it returns the failure of the second future. Maybe it should be something like this?

    def fallbackTo[U >: T](that: Future[U]): Future[U] = {
      val p = Promise[U]()
      onComplete {
        case s @ Success(_) => p complete s
        case f =>  that.onComplete {
          case s @ Success(_) => p complete s
          case _ => p complete f
        }
      }
      p.future
    }
@scabug
Copy link
Author

scabug commented Jan 4, 2013

Imported From: https://issues.scala-lang.org/browse/SI-6913?orig=1
Reporter: Bob Hiestand (bhiestand)
Affected Versions: 2.10.0-RC5
Other Milestones: 2.11.0-M8

@scabug
Copy link
Author

scabug commented Jan 14, 2013

@viktorklang said:
Proposed fix here: https://github.com/viktorklang/scala/pull/5/commits

@scabug
Copy link
Author

scabug commented Nov 22, 2013

@heathermiller said:
That PR somehow got chunked up and this fix since got lost. New PR:
scala/scala#3181

@scabug scabug closed this as completed Dec 5, 2013
@scabug scabug added the library label Apr 7, 2017
@scabug scabug added this to the 2.10.4-RC2 milestone Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant