amnaredo / test

0 stars 0 forks source link

UPickle doesn't understand case classes with varags #95

Open amnaredo opened 3 years ago

amnaredo commented 3 years ago

Consider:

package example

import upickle._

case class Sentence(words: String*)

object TestUPickle extends App {
  println(write(new Sentence("a", "b")))
}

Compiling this leads to an error:

Error:(8, 16) uPickle does not know how to write [example.Sentence]s; define an implicit Writer[example.Sentence] to teach it how
  println(write(new Sentence("a", "b")))
               ^
Error:(8, 16) not enough arguments for method write: (implicit evidence$1: upickle.Writer[example.Sentence])String.
Unspecified value parameter evidence$1.
  println(write(new Sentence("a", "b")))
               ^

If I were to change words to be of Seq[String] type, it works fine. It should have worked either way.

ID: 45 Original Author: ramnivas

amnaredo commented 3 years ago

Yeah, it should

Original Author: lihaoyi