Closed
Description
scala 2.13.5> class C; class D extends C
scala 2.13.5> class Test { def foo: C = new C }
scala 2.13.5> class Test2 extends Test { override def foo = new D }
scala 2.13.5> (new Test2).foo
val res0: D = D@5d32c1c7
whereas in Scala 3 the type of res0
is C
I'm fairly sure this is intended behavior in Scala 3, but I can't seem to find either a ticket, or a migration guide entry about it.
There is a ticket complaining about the Scala 2 behavior: scala/bug#7212