amnaredo / test

0 stars 0 forks source link

PPrint fails to derive a printer for case classes with more than 1 argument list #169

Open amnaredo opened 3 years ago

amnaredo commented 3 years ago
@ case class A(x: List[String], y: Int) 
defined class A
@ A(List.fill(10)("long string"), 0) 
res12: A = A(
  List(
    "long string",
    "long string",
    "long string",
    "long string",
    "long string",
    "long string",
    "long string",
    "long string",
    "long string",
    "long string"
  ),
  0
)
@ case class B(x: List[String])(y: Int) 
defined class B
@ B(List.fill(10)("long string"))(0) 
res14: B = B(List(long string, long string, long string, long string, long string, long string, long string, long string, long string, long string))

ID: 148 Original Author: stanch

amnaredo commented 3 years ago

This also appears to impact upickle:

scala> case class B(x: List[String])(y: Int)
defined class B

scala> upickle.default.write(B(List.fill(10)("long string"))(0))
<console>:13: error: type mismatch;
 found   : Option[List[String]]
 required: Option[(List[String], Int)]
Error occurred in an application involving default arguments.
       upickle.default.write(B(List.fill(10)("long string"))(0))

Original Author: Voltir

amnaredo commented 3 years ago

From what I can tell, it’s fixed somewhere in 0.5.0. At least ammonite 0.9.0 no longer has this problem. Original Author: stanch