Open amnaredo opened 3 years ago
This is really driving me crazy...
The offending class' signature is as follows:
case class AdminFoodRecord(main: MainFoodRecord, local: LocalFoodRecord, brands: Seq[String], associatedFoods: Seq[UserAssociatedFood])
the following line produces the above error:
val t = write(record) // record is an instance of AdminFoodRecord
but none of the following lines produce any problems:
val t1 = write(record.main)
val t2 = write(record.local)
val t3 = write(record.brands)
val t4 = write(record.associatedFoods)
Now, if I add or remove a random field from AdminFoodRecord
, the error goes away. It also goes away if I add or remove any field from UserAssociatedFood
, which is
case class UserAssociatedFood (foodOrCategory: Either[UserFoodHeader, UserCategoryHeader], promptText: String, linkAsMain: Boolean, genericName: String)
so for instance if I do
case class UserAssociatedFood (foodOrCategory: Either[UserFoodHeader, UserCategoryHeader], promptText: String, linkAsMain: Boolean, genericName: String, test: String = "123")
the problem goes away.
But the error still occurs if
Now, the only thing in common between these two classes is that they both happen to have 4 fields, so I think this might be a problem with Tuple4W
(which is generated and not any different from other case class lengths as far as I can see...), or else some obscure bug in the Scala compiler.
I tried inspecting the implicit resolution with -Xlog-implicits
but that was an unreadable 800Kb mess...
Original Author: mechkg
+1. I have the same problem.
Original Author: danielyli
I run into this fairly often and I found a somewhat reliable solution on another issue somewhere (I think auto wire?) essentially the macros are being generated twice which is why they are ambiguous. Try specifying an implicit reader or writer such as
def doSomething(myClass : MyClass)(implicit writer : upickle.default.Writer[MyClass]) = { upickle.default.write(myClass) }.
Original Author: tannerezell
+1 Same problem here. And tannerezell's solution does not help.
Original Author: jk-1
I have the same problem. Is the problem with uPickle itself?
Okay: case class CheckedInvoiceSet(invoices: Seq[InvoiceBar], adjustments: Seq[Adjustment],creditNotes: Seq[CreditNoteRow]) //ok
Fails: case class CheckedInvoiceSet(invoices: Seq[InvoiceBar], adjustments: Seq[Adjustment],creditNotes: Seq[CreditNoteRow], latestCreditNoteNumbers: Int) // fails
Succeeds: case class CheckedInvoiceSet(invoices: Seq[InvoiceBar], adjustments: Seq[Adjustment],creditNotes: Seq[CreditNoteRow], latestCreditNote: CreditNoteRow) // succeeds
Original Author: aholland
@aholland Yes. It is definitely a bug. I could find no working workaround. Original Author: ebruchez
Sometimes you can fix this by simply removing the import:
import upickle.default._
and instead import only the specific parts you need. Original Author: tannerezell
Bug bankruptcy Original Author: lihaoyi
What does that mean?
On 19 December 2017 at 02:31, Li Haoyi notifications@github.com wrote:
Bug bankruptcy
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/lihaoyi/upickle/issues/168#issuecomment-352621356, or mute the thread https://github.com/notifications/unsubscribe-auth/AAx_-lVepvuGeYu-oltCSPr2iqco5my4ks5tByAYgaJpZM4Jax2B .
Original Author: mechkg
@mechkg it means Haoyi won't be fixing this bug as he is overwhelmed. I managed to combine Autowire with Circe instead of uPickle, here: https://github.com/aholland/autowire-circe
Original Author: aholland
I am getting seemingly random error messages like
These are very confusing since the types that supposedly match the expected type are unrelated, so there is no way they can both match.
Also, this part:
uPickle does not know how to write [T1]s; define an implicit Writer[T1] to teach it how
-- T1 does not seem to be a real type, just a placeholder name.How can I make sense of this? In particular, how can I tell what is the actual type of T1?
ID: 168 Original Author: mechkg