@@ -8,6 +8,8 @@ import Symbols.*
8
8
import Types .*
9
9
import StdNames .*
10
10
import NameKinds .OuterSelectName
11
+ import NameKinds .SuperAccessorName
12
+ import NameOps .unexpandedName
11
13
12
14
import ast .tpd .*
13
15
import config .Printers .init as printer
@@ -788,7 +790,9 @@ object Semantic:
788
790
if ! needResolve then
789
791
meth
790
792
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)
792
796
else
793
797
resolve(ref.klass, meth)
794
798
@@ -829,7 +833,7 @@ object Semantic:
829
833
value.select(target, receiver, needResolve = false )
830
834
else
831
835
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)
833
837
Hot
834
838
else
835
839
// This is possible due to incorrect type cast.
@@ -1175,9 +1179,8 @@ object Semantic:
1175
1179
// Note that a parameterized trait may only get parameters from the class that extends the trait.
1176
1180
// A trait may not supply constructor arguments to another trait.
1177
1181
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.
1180
1182
val superCls = klass.superClass
1183
+ if superCls.hasSource then doPromote(superCls.asClass, klass, isHotSegment)
1181
1184
val mixins = klass.baseClasses.tail.takeWhile(_ != superCls)
1182
1185
for mixin <- mixins if mixin.hasSource do doPromote(mixin.asClass, klass, isHotSegment)
1183
1186
end doPromote
@@ -1768,16 +1771,3 @@ object Semantic:
1768
1771
if (sym.isEffectivelyFinal || sym.isConstructor) sym
1769
1772
else sym.matchingMember(cls.appliedRef)
1770
1773
}
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