@@ -8,6 +8,8 @@ import Symbols.*
88import Types .*
99import StdNames .*
1010import NameKinds .OuterSelectName
11+ import NameKinds .SuperAccessorName
12+ import NameOps .unexpandedName
1113
1214import ast .tpd .*
1315import config .Printers .init as printer
@@ -788,7 +790,9 @@ object Semantic:
788790 if ! needResolve then
789791 meth
790792 else if superType.exists then
791- resolveSuper(ref.klass, superType, meth)
793+ meth
794+ else if meth.name.is(SuperAccessorName ) then
795+ ResolveSuper .rebindSuper(ref.klass, meth)
792796 else
793797 resolve(ref.klass, meth)
794798
@@ -829,7 +833,7 @@ object Semantic:
829833 value.select(target, receiver, needResolve = false )
830834 else
831835 if ref.klass.isSubClass(receiver.widenSingleton.classSymbol) then
832- report.error(" Unexpected resolution failure: ref.klass = " + ref.klass.show + " , meth = " + meth.show + Trace .show, Trace .position)
836+ report.error(" [Internal error] Unexpected resolution failure: ref.klass = " + ref.klass.show + " , meth = " + meth.show + Trace .show, Trace .position)
833837 Hot
834838 else
835839 // This is possible due to incorrect type cast.
@@ -1175,9 +1179,8 @@ object Semantic:
11751179 // Note that a parameterized trait may only get parameters from the class that extends the trait.
11761180 // A trait may not supply constructor arguments to another trait.
11771181 if ! klass.is(Flags .Trait ) then
1178- for parent <- klass.parentSyms if parent.hasSource do doPromote(parent.asClass, klass, isHotSegment)
1179- // We still need to handle indirectly extended traits via traits, which are not in the parent list.
11801182 val superCls = klass.superClass
1183+ if superCls.hasSource then doPromote(superCls.asClass, klass, isHotSegment)
11811184 val mixins = klass.baseClasses.tail.takeWhile(_ != superCls)
11821185 for mixin <- mixins if mixin.hasSource do doPromote(mixin.asClass, klass, isHotSegment)
11831186 end doPromote
@@ -1768,16 +1771,3 @@ object Semantic:
17681771 if (sym.isEffectivelyFinal || sym.isConstructor) sym
17691772 else sym.matchingMember(cls.appliedRef)
17701773 }
1771-
1772- def resolveSuper (cls : ClassSymbol , superType : Type , sym : Symbol )(using Context ): Symbol =
1773- import annotation .tailrec
1774- @ tailrec def loop (bcs : List [ClassSymbol ]): Symbol = bcs match {
1775- case bc :: bcs1 =>
1776- val cand = sym.matchingDecl(bcs.head, cls.thisType)
1777- .suchThat(alt => ! alt.is(Flags .Deferred )).symbol
1778- if (cand.exists) cand else loop(bcs.tail)
1779- case _ =>
1780- NoSymbol
1781- }
1782- loop(cls.info.baseClasses.dropWhile(sym.owner != _))
1783-
0 commit comments