You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Silence outer pointer warnings in class-based REPL
Case classes, such as final case classes nested within other classes,
lose their outer pointer which makes their equality lie (scala/bug#4440):
scala> class Outer { final case class Inner(n: Int) }
warning: there was one unchecked warning; for details, enable `:setting -unchecked' or `:replay -unchecked'
defined class Outer
scala> val o1, o2 = new Outer
o1: Outer = Outer@627bcd7e
o2: Outer = Outer@70543cae
scala> new o1.Inner(1) == new o2.Inner(1)
res0: Boolean = true
vs
scala> class Outer { case class Inner(n: Int) }
defined class Outer
scala> val o1, o2 = new Outer
o1: Outer = Outer@77ba583
o2: Outer = Outer@5613247e
scala> new o1.Inner(1) == new o2.Inner(1)
res0: Boolean = false
This isn't a problem in the REPL even with its class-based wrappers as
there is only ever 1 instance of (each) wrapper class.
0 commit comments