Using : Scala 2.10.3
Trying to compile the following gives an error. If I remove the case-class then it compiles.
Anythoughts on where the double is being resolved from?
object DomainTypes {
type Tagged[T] = { type Tag = T }
trait DeviceIdTag
type DeviceId = Int with Tagged[DeviceIdTag]
implicit class TaggedInt(val data: Int) extends AnyVal {
def deviceId = {
require(data >= 1)
data.asInstanceOf[DeviceId]
}
}
}
case class DeviceIdHolder(odeviceId:DeviceId)
[error] type mismatch; [error] found : Double [error] required: AnyRef [error] Note: an implicit exists from scala.Double => java.lang.Double, but [error] methods inherited from Object are rendered ambiguous. This is to avoid [error] a blanket implicit which would convert any scala.Double to any AnyRef. [error] You may wish to use a type ascription:
x: java.lang.Double
. [error] one error found [error] (compile:compile) Compilation failed [error] Total time: 0 s, completed Mar 2, 2014 11:47:01 AM
If you replace the INT's with String's then it compiles, so I don't think there is anything structurally wrong per-se.