This file contains hidden or 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
import org.scalatest.{Matchers, FlatSpec} | |
case class Foo(bar: Option[String]) | |
object Foo { | |
// Unexpectedly, Foo.Default.bar is null at runtime. Swapping the order of Default and Unknown, or making | |
// either of them a lazy val, fixes the issue. | |
val Default = Foo(Unknown) | |
val Unknown = None | |
} |