Skip to content

Commit f5313ae

Browse files
author
EnzeXing
committed
add fix for issue #17997 affecting the global object initialization checker
1 parent 96ca0b6 commit f5313ae

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

compiler/src/dotty/tools/dotc/transform/init/Objects.scala

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1021,7 +1021,16 @@ object Objects:
10211021
ref match
10221022
case Select(supert: Super, _) =>
10231023
val SuperType(thisTp, superTp) = supert.tpe: @unchecked
1024-
val thisValue2 = extendTrace(ref) { resolveThis(thisTp.classSymbol.asClass, thisV, klass) }
1024+
val thisValue2 = extendTrace(ref) {
1025+
thisTp match
1026+
case thisTp: ThisType =>
1027+
evalType(thisTp, thisV, klass)
1028+
case AndType(thisTp: ThisType, _) =>
1029+
evalType(thisTp, thisV, klass)
1030+
case _ =>
1031+
report.warning("[Internal error] Unexpected type " + thisTp.show + ", trace:\n" + Trace.show, ref)
1032+
Bottom
1033+
}
10251034
withTrace(trace2) { call(thisValue2, ref.symbol, args, thisTp, superTp) }
10261035

10271036
case Select(qual, _) =>

0 commit comments

Comments
 (0)