This repository has been archived by the owner on Feb 20, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle sealed classes in check for non-cyclic types
When deciding to delay the initialization of fields due to possible cycles, sealed classes were not handled. This could cause issues, such as #128, where the initialization of a constructor parameter was delayed and thus the parameter was null during the execution of the constructor.
- Loading branch information
Showing
2 changed files
with
56 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package scala.pickling.test.issue128 | ||
|
||
import scala.pickling._ | ||
import scala.pickling.json._ | ||
|
||
import org.scalatest.FunSuite | ||
|
||
case class A(intOpt: Option[Int]) { | ||
intOpt match { | ||
case Some(int) => | ||
case None => | ||
} | ||
} | ||
|
||
class Issue128Test extends FunSuite { | ||
test("Issue #128") { | ||
val opt = Some(5) | ||
val a = A(opt) | ||
val pickle = a.pickle | ||
assert(pickle.unpickle[A] === a) | ||
} | ||
} |