jeudi 29 janvier 2015

Pattern match abstact type


trait Aggregate {
type Command
}

class AggregateHandler(a: Aggregate) {
def receiveCommand: Receive = {
case a.Command => ???
}
}


How can I pattern match on a.Command? I am getting; abstract type pattern AggregateHandler.this.a.Command is unchecked since it is eliminated by erasure and The outer reference in this type test cannot be checked at run time.


How can I workaround this?






Aucun commentaire:

Enregistrer un commentaire