{"action":"created","issue":{"url":"https://api.github.com/repos/lihaoyi/upickle-pprint/issues/159","repository_url":"https://api.github.com/repos/lihaoyi/upickle-pprint","labels_url":"https://api.github.com/repos/lihaoyi/upickle-pprint/issues/159/labels{/name}","comments_url":"https://api.github.com/repos/lihaoyi/upickle-pprint/issues/159/comments","events_url":"https://api.github.com/repos/lihaoyi/upickle-pprint/issues/159/events","html_url":"https://github.com/lihaoyi/upickle-pprint/issues/159","id":160488126,"number":159,"title":"Ambiguous Implicit values / Diverging implicit expansion","user":{"login":"onlyNexusHere","id":12589143,"avatar_url":"https://avatars.githubusercontent.com/u/12589143?v=3","gravatar_id":"","url":"https://api.github.com/users/onlyNexusHere","html_url":"https://github.com/onlyNexusHere","followers_url":"https://api.github.com/users/onlyNexusHere/followers","following_url":"https://api.github.com/users/onlyNexusHere/following{/other_user}","gists_url":"https://api.github.com/users/onlyNexusHere/gists{/gist_id}","starred_url":"https://api.github.com/users/onlyNexusHere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/onlyNexusHere/subscriptions","organizations_url":"https://api.github.com/users/onlyNexusHere/orgs","repos_url":"https://api.github.com/users/onlyNexusHere/repos","events_url":"https://api.github.com/users/onlyNexusHere/events{/privacy}","received_events_url":"https://api.github.com/users/onlyNexusHere/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-06-15T18:12:50Z","updated_at":"2016-08-18T00:06:09Z","closed_at":null,"body":"uPickle unable to parse through this code:\r\n\r\n```\r\nimport upickle.default._\r\ntype Env = Map[String,V]\r\nobject Simple {\r\n\r\n  type Var = String\r\n\r\n  sealed trait Expr      //will be evaluated into V\r\n  case class ENum(n: Double) extends Expr\r\n  case class EVar(name: String) extends Expr\r\n  case class EOp(op: String, es: Seq[Expr]) extends Expr\r\n  case class EFun(formal: String, body: Expr) extends Expr\r\n  case class EApp(fun: Expr, actual: Expr) extends Expr\r\n\r\n  sealed trait V           //cannot be evaluated further\r\n  case class VNum(n: Double) extends V\r\n  case class VClosure(x: String, body: Expr, t: Map[String, V]) extends V\r\n\r\n  sealed trait VorE     //a wrapped that excepts either Expr or V\r\n  case class Vo(v: V) extends VorE\r\n  case class Eo(e: Expr) extends VorE\r\n\r\n  type Stack = List[K]\r\n\r\n  sealed trait K     //Stack items. Exprs and variables are turned into stack items when placed on stack.\r\n  case class KArg(e: Expr) extends K\r\n  case class KClosure(formal: String, body: Expr, t: Map[String,V]) extends K\r\n  case class KOp(op: String, env: Map[String,V], vals: List[V], exprs: Seq[Expr]) extends K\r\n\r\n              // These lines compile\r\n// def writeState(state: (List[K], Env, VorE)): String = write(state)\r\n//   def readState(str: String): (List[K], Env, VorE) = read[(List[K], Env, VorE)](str)\r\n  \r\n           // These lines do not compile\r\n//   def writeKClos(trial: KClosure) : String = write(trial)\r\n//   def readKClos(str: String): KClosure = read[KClosure](str)\r\n  \r\n          // These lines do not compile.\r\n  def write3Tuple(n: (String, Expr, Map[String, V])): String = write[(String, Expr, Map[String, V])](n)\r\n  def read3Tuple(str: String): (String, Expr, Map[String, V]) = read[(String, Expr, Map[String, V])](str)\r\n}\r\n\r\n```\r\nWith exactly this code, I get this error message:\r\n\r\n> \\> [info] Compiling 2 Scala sources...\r\n[error] Line 37: ambiguous implicit values:\r\n[error]  both value derive$macro$249 of type => upickle.default.Writer[(String, Simple.Expr, Map[String,Simple.V])]\r\n[error]  and value derive$macro$266 of type => upickle.default.Writer[Simple.EOp]\r\n[error]  match expected type upickle.default.Writer[T1]\r\n[error] Error occurred in an application involving default arguments.\r\n[error]   def write3Tuple(n: (String, Expr, Map[String, V])): String = write[(String, Expr, Map[String, V])](n)\r\n[error]                                                                                                     ^\r\n[error] Line 38: ambiguous implicit values:\r\n[error]  both value derive$macro$588 of type => upickle.default.Reader[(String, Simple.Expr, Map[String,Simple.V])]\r\n[error]  and value derive$macro$605 of type => upickle.default.Reader[Simple.EOp]\r\n[error]  match expected type upickle.default.Reader[T1]\r\n[error]   def read3Tuple(str: String): (String, Expr, Map[String, V]) = read[(String, Expr, Map[String, V])](str)\r\n[error]                                                                                                     ^\r\n[error] two errors found\r\n[error] (rootJVM/compile:compileIncremental) Compilation failed\r\n[error] Total time: 8 s, completed Jun 15, 2016 1:44:19 PM\r\n\r\nWith the `def writeKClos` and `def readKClos` uncommented and the last two lines commented, I get:\r\n\r\n> \\>compile\r\n[info] Compiling 2 Scala sources...\r\n[error]Line 34: diverging implicit expansion for type upickle.default.Writer[T1]\r\n[error] starting with macro method macroW in trait LowPriX\r\n[error] Error occurred in an application involving default arguments.\r\n[error]    def writeKClos(trial: KClosure) : String = write(trial)\r\n[error]                                                    ^\r\n[error]Line 35: diverging implicit expansion for type upickle.default.Reader[T1]\r\n[error] starting with macro method macroR in trait LowPriX\r\n[error]    def readKClos(str: String): KClosure = read[KClosure](str)\r\n[error]                                                         ^\r\n[error] two errors found\r\n[error] (rootJVM/compile:compileIncremental) Compilation failed\r\n[error] Total time: 11 s, completed Jun 15, 2016 1:54:23 PM\r\n\r\nWhen `def writeState` and `def readState` are not commented and all following lines are commented, the code compiles fine.\r\n\r\nI am not sure what diverging implicit expansion means in terms of how my project is laid out. However, everything that is included in the file should compile file. It does not, and I have no idea why.\r\n\r\nNotes:\r\nThis is all done with sbt on a Mac. Nothing in the project is imported, and no other file uses this file.\r\nThis is not quite what I was using in the project, but this is the simplest example where the behavior shows. \r\n"},"comment":{"url":"https://api.github.com/repos/lihaoyi/upickle-pprint/issues/comments/240586782","html_url":"https://github.com/lihaoyi/upickle-pprint/issues/159#issuecomment-240586782","issue_url":"https://api.github.com/repos/lihaoyi/upickle-pprint/issues/159","id":240586782,"user":{"login":"danielyli","id":1744438,"avatar_url":"https://avatars.githubusercontent.com/u/1744438?v=3","gravatar_id":"","url":"https://api.github.com/users/danielyli","html_url":"https://github.com/danielyli","followers_url":"https://api.github.com/users/danielyli/followers","following_url":"https://api.github.com/users/danielyli/following{/other_user}","gists_url":"https://api.github.com/users/danielyli/gists{/gist_id}","starred_url":"https://api.github.com/users/danielyli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielyli/subscriptions","organizations_url":"https://api.github.com/users/danielyli/orgs","repos_url":"https://api.github.com/users/danielyli/repos","events_url":"https://api.github.com/users/danielyli/events{/privacy}","received_events_url":"https://api.github.com/users/danielyli/received_events","type":"User","site_admin":false},"created_at":"2016-08-18T00:06:09Z","updated_at":"2016-08-18T00:06:09Z","body":"Thanks for letting me know.  Unfortunately, I'm already using `sealed` everywhere, so that isn't the problem. I'll keep hunting..."}}
{"actor":{"display_login":"danielyli"}}