I have the following scenario:
sealed abstract class Type(val inUse: Boolean)
case class IntTy(override val inUse: Boolean) extends Type(inUse)
case class TupleTy(override val inUse: Boolean, elems: Type*) extends Type(inUse) {
def this(elems: Type*) = this(false, elems:_*)
}
In Scala 2.8.0 this works just fine and I can create a new TupleTy instance with:
TupleTy(IntTy(false))
However, I’ve just updated to Scala 2.9.1 final and it no longer works. I now get the following error:
error: type mismatch;
found : IntTy
required: Boolean
TupleTy(IntTy(false))
^
Is this a bug or am I missing somehing?
I’m not sure that it works in 2.8.0.
You have defined an additional constructor, but not an additional factory method.
EDIT
Here is a possible workaround
Now you can do ugly things like this, but you shouldn’t. No really, you shouldn’t.