I use scala 2.11.2. This is part of my function:
import scala.reflect.runtime.universe._
p => p.filter(p => typeOf[p.type] != typeOf[Nothing]).flatMap {
case Some(profile) => {
...
env.userService.save(profile.copy(passwordInfo = Some(hashed)),...) //<---------error here
}
case _ => ...
}
the compile error is:
PasswordReset.scala:120: value copy is not a member of Nothing
[error] env.userService.save(profile.copy(passwordI
nfo = Some(hashed)), SaveMode.PasswordChange);
[error] ^
I think I use filter phase filter the Nothing type, but why it is still give me type Nothing error. I do not want to:
profile.getDefault().copy(...)
Because I really need to copy the profile instead of to copy the default value, if profile is Nothing just delete it. How to do it?