Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generated code for case class with Map field has default value incorrect #141

Closed
cuongdd2 opened this issue Aug 10, 2018 · 0 comments
Closed
Labels

Comments

@cuongdd2
Copy link
Contributor

I see a bug when serialize to case class A(fields: Map[String, Int] = Map())
Generated code becomes: private[this] val c0: scala.collection.immutable.Map[String,Int] = Map.empty[String];
without default value, it's fine
The bug due to this line of code:

genReadMap(q"var x = ${withNullValueFor(tpe)(q"${collectionCompanion(tpe)}.empty[$tpe1]")}",
            q"x = x.updated(in.readKeyAsLong(), ${genReadVal(tpe1, nullValue(tpe1), isStringified)})")

collectionCompanion(tpe)}.empty[$tpe1] should be collectionCompanion(tpe)}.empty[$tpe1,$tpe2]

cuongdd2 pushed a commit to cuongdd2/jsoniter-scala that referenced this issue Aug 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants