EindbaasExpress / handsonscala-issuemigrator

Part of the HandsOnScala Course
0 stars 0 forks source link

Evidence case classes must be declared in a class that read method is called from #36

Open EindbaasExpress opened 2 years ago

EindbaasExpress commented 2 years ago

So that this works :

object A extends B {
   case class SomeEvidenceClass(blablala)
   read[SomeEvidenceClass](something)
}

But if SomeEvidenceClass is declared in parent trait B, it won't work...

In other words:

Types#read[T: Reader](expr: String): T

If the T evidence is a case class and it can be read by Generated Tuple Reader, it must be declared in the class that read method is called from. If you declare it for instance in a parent trait, you get :

uPickle does not know how to read SomeEvidenceCaseClass define an implicit Reader[SomeEvidenceCaseClass]

ID: 18 Original Author: l15k4