I’m getting this compilation message:
inferred type arguments [sdo.core.domain.Field[_ >: 2 with java.util.UUID <: java.lang.Comparable[ >: 1 with java.util.UUID <: java.lang.Object] with java.io.Serializable]] do not conform to method ::’s type parameter bounds [B >: sdo.core.domain.Field[ >: String with org.scala_tools.time.Imports.DateTime <: java.lang.Comparable[_ >: java.lang.String with org.joda.time.ReadableInstant <: java.lang.Object] with java.io.Serializable]]
[error] override def fieldList = this.id :: this.create :: this.name :: this.description :: Nil
What I want is a list of Field[_], or anything covariant with Field[_]. How do I do that?
Here’s the code with the issue:
class Work( initialId :EntityUuidIdField,
initialName :NameField,
initialDescription :TextField) extends Entity{
val id = initialId
val name = initialName
val description :Field[String]= initialDescription
val create = new DateTimeField()
val begun = new DateTimeField()
val inProgress = new DateTimeField()
val done = new DateTimeField()
val subjectiveWellBeing = new SubjectiveWellBeingField()
val size = new WorkSizeField()
override def fieldList = this.id :: this.create :: this.name :: this.description :: Nil
}
And the definitions of the types:
class DateTimeField extends Field[DateTime] {
class EntityUuidIdField( val id :UUID) extends EntityIdField[UUID]( id) {
class EntityIdField[T]( id :T) extends Field[T] {
class NameField extends Field[String] {
class Field[T] extends Signal[T] {
It looks like it doesn’t like the intersection of the three types; I haven’t tried -Yinfer-debug yet.
But List(x,y,z) is OK.