Reputation: 11
val auth = for{....} yield {....}
val redirect : Result = Redirect(routes.PageController.landing())
auth.getOrElse{
Future(redirect)
}
Error :
/home/orkun/Workspace/DatabaseProject/app/controllers/PageController.scala:104:
type mismatch;
found : scala.concurrent.Future[Object]
required: scala.concurrent.Future[play.api.mvc.Result]
Compiler giving me this error. I don't know why I checked everyting. It was working properly.
Upvotes: 0
Views: 48
Reputation: 4411
The type of auth
is not Future[Result]
, it's Future[T]
, where T
doesn't share a parent class with Result
. This makes getOrElse
infer the common parent as java.lang.Object
, making the return type incorrect.
You need to fix your for-yield
statement.
Upvotes: 2