The compiler reports that the type is Error1 because it is the type of the first parameter passed to reset.
In terms of answering a direct question, you can tell the compiler that this is Error1, but the corresponding type is Status, passing the type explicitly as Status
sealed trait Status object Error1 extends Status case class Ok(x: Int) extends Status def foo(opt: Option[Int]): Status = opt.fold(Error1: Status)(x => Ok(x))
The foo function will then return as follows:
scala> foo(Option(5)) res0: Status = Ok(5)
source share