Skip to content

“futures.sc” value onSuccess is not a member of scala.concurrent.Future[Int] #27

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

Closed
byejude opened this issue Nov 21, 2019 · 1 comment

Comments

@byejude
Copy link

byejude commented Nov 21, 2019

script's location is .\src\main\scala\progscala2\typelessdomore/futures.sc

when i load the script ,its console print 'error: value onSuccess is not a member of scala.concurrent.Future[Int]'

and i use
future onComplete { case Success(x) => println(s"success and return is $x") case Failure(t) => println(s"An error has occured: $t" ) }
to replace it,its run sucessful,and i dont know why
i use scala 2.13.1

@deanwampler
Copy link
Owner

Thanks for pointing this out. I don't have automated tests yet for the scripts. I plan to add them while working on the third edition of the book.

The old onSuccess and onFailure methods were deprecated in 2.12 and removed in 2.13. I just pushed a change to the file that uses the onComplete method like you used it.

@byejude byejude closed this as completed Nov 22, 2019
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

No branches or pull requests

2 participants