Quantcast
Channel: MarsHut
Viewing all articles
Browse latest Browse all 6551

Return case object with Future, but compiler complains not found type

$
0
0
I have a simple question that I can't figured out very well. Searching this
forum (with key words not found type csae object) does not find solutions
for my problem. Goolging shows the following thread is quite close to my
question but still not answer my question.

http://stackoverflow.com/questions/24353368/serialize-case-object-extending-trait

My problem is I have a trait having a function that returns a
scala.concurrent.Future with case object X.

final case object X

trait A {
def n(): Future[X]

But compiler complains "... error: not found: value ..."

From the SO thread, it seems that creating case object only refers to its
name, but not type. However, I do not know the correct syntax referring to
its type.

I tried following alternatives but problem still remains:
- Changing Future[X] to Future[X.type]
- Using trait
sealed trait Parent
final case object X extends Parent
trait A {
def n(): Future[Parent]

Compiler still throws error "not found type"
How to fix this error?

Thanks

Viewing all articles
Browse latest Browse all 6551

Trending Articles