I'm trying to do something like that:
trait IdentifiableModel[T] { self: { def copy(id: ObjectId): T } => val id: ObjectId } I've found some other related questions trying to do similar things but they didn't really answer to this question. In my case, I'm trying to copy the case class subclasses of IdentifiableModel that all share an id value
idfield and want to be able to call the automatically generatedcopymethod polymorphically (that is, through their common base classIdentifiableModel)?Tinstance having anid: ObjectIdfield into anIdentifiableModel[T] { def copy(id: ObjectId): T }. In scala 2.10.1, due to a bug in implicit macros, (issues.scala-lang.org/browse/SI-5923), you'll have to use a trick with existential types, unless you can wait for 2.10.2, it seems. I'd be interested in knowing more about your complete use case though, to check it'll work as mentioned above.