File tree 2 files changed +19
-1
lines changed
compiler/src/dotty/tools/dotc/core
2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -3037,7 +3037,8 @@ object Types {
3037
3037
abstract case class SuperType (thistpe : Type , supertpe : Type ) extends CachedProxyType with SingletonType {
3038
3038
override def underlying (using Context ): Type = supertpe
3039
3039
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
3041
3042
def derivedSuperType (thistpe : Type , supertpe : Type )(using Context ): Type =
3042
3043
if ((thistpe eq this .thistpe) && (supertpe eq this .supertpe)) this
3043
3044
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