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

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -

java - Digest auth with Spring Security using javaconfig -