Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't derive a type that involves a hierarchy of traits + scalajs

See original GitHub issue


class Field {}

class Abc {
  def p: (Field, Map[String, String]) = (null, null)


[error] Couldn't derive type uni.Abc
[error]       read[uni.Abc]("")

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

DavidPerezIngenierocommented, Jan 17, 2017

This runs ok from the REPL in Ammonite:

import upickle.default._

case class Datos(@key("Bytes enviados/min") enviados: Int,
                 Conectados: Int,
                 @key("Bytes recibidos/min") recibidos: Int,
                 @key("Tramas/min") tramas: Int,
                 @key("ErroresPost/min") errores: Int,
                 @key("Post/min") post: Int)
val d = read[Datos](".....")

but fails to compile when used inside an Ammonite script:

Couldn't derive type Datos
                val d = read[Datos]("......")

Should I open another bug issue?

DavidPerezIngenierocommented, Jan 17, 2017

Solved by making Datos a top level class, instead of nested inside a function.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't derive a type that involves a hierarchy of traits + scalajs
Here is a complete test project. Strangely, the jvm sub project can be made to work by changing the scala-js version to 0.6.3...
Read more >
scalalandio/chimney - Gitter
@krzemin Let's say I have two sealed trait hierarchies A and B . When I want to go ... Chimney can't derive transformation...
Read more >
Defining a non-native JS type - Scala.js
Non-native JS traits cannot declare concrete term members (i.e., they must all be abstract) unless their right-hand-side is exactly = js.undefined .
Read more >
Scala: Building a complex hierarchy of traits and classes
My current implementation for StateSite does not have type parameters; it is a standard hierarchy of traits, terminating in classes that have a ......
Read more >
µPickle 2.0.0
For ScalaJS applications, use this dependencies instead: ... just use type of the sealed trait read[IntOrTuple]("""{"$type":"upickle.example.Sealed.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found