Skip to content
This repository was archived by the owner on Feb 20, 2019. It is now read-only.
This repository was archived by the owner on Feb 20, 2019. It is now read-only.

Option fields in case classes are null in the constructor when unpickling #128

Closed
@bardurdam

Description

@bardurdam
import org.scalatest.FunSuite
import scala.pickling._, Defaults._
import json._

class Test extends FunSuite {
  test("main") {
    val a = A(Some(5))
    val pickle = a.pickle
    assert(pickle.unpickle[A] === a)
  }
}
case class A(intOpt: Option[Int]) {
  intOpt match {
    case Some(int)  
    case None 
  }
}

results in

[info] Test:
[info] - main *** FAILED ***
[info]   scala.MatchError: null
[info]   at A.<init>(Test.scala:14)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions