File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -3037,7 +3037,8 @@ object Types {
30373037 abstract case class SuperType (thistpe : Type , supertpe : Type ) extends CachedProxyType with SingletonType {
30383038 override def underlying (using Context ): Type = supertpe
30393039 override def superType (using Context ): Type =
3040- thistpe.baseType(supertpe.typeSymbol)
3040+ if supertpe.typeSymbol.exists then thistpe.baseType(supertpe.typeSymbol)
3041+ else super .superType
30413042 def derivedSuperType (thistpe : Type , supertpe : Type )(using Context ): Type =
30423043 if ((thistpe eq this .thistpe) && (supertpe eq this .supertpe)) this
30433044 else SuperType (thistpe, supertpe)
Original file line number Diff line number Diff line change 1+ class Root {
2+ override def toString () = " Root"
3+ }
4+ trait A extends Root with B { }
5+ trait B {
6+ override def toString () = " B"
7+ }
8+ case class C () extends A {
9+ override def toString () = super .toString()
10+ }
11+ class D () extends A , Serializable {
12+ override def toString () = super .toString()
13+ }
14+
15+ @ main def Test =
16+ assert(C ().toString == " B" )
17+ assert(D ().toString == " B" )
You can’t perform that action at this time.
0 commit comments