scala - ScalaC exception on attempt to use upper bound and context bound at the same time -
i scalac exception on attempt use upper bound , context bound @ same time. allowed ? i'm on scala 2.11.8
consider this
import spray.json._ abstract class crossrefmessage case class crossrefresponse[t <: crossrefmessage](status: string, `message-type`: string, `message-version`: string, message: t) implicit def crossrefresponseformat[t <: crossrefmessage](implicit reader: jsonformat[t]) = jsonformat4(crossrefresponse.apply[t])
on compilation get
error:scalac: error: type mismatch; found : string required: co.zzzz.server.journalsmanager.crossrefmessage scala.reflect.internal.types$typeerror: type mismatch; found : string required: co.zzzz.server.journalsmanager.crossrefmessage @ scala.tools.nsc.typechecker.contexts$throwingreporter.handleerror(contexts.scala:1402) @ scala.tools.nsc.typechecker.contexts$contextreporter.issue(contexts.scala:1254) @ scala.tools.nsc.typechecker.contexts$context.issue(contexts.scala:573) @ scala.tools.nsc.typechecker.contexterrors$errorutils$.issuetypeerror(contexterrors.scala:106)
what missing ?
update: looks magic me error goes away if change position of field message: t
. compiles if it's on 1st or 2nd position. can explain why ?
Comments
Post a Comment