File tree 1 file changed +4
-1
lines changed
compiler/src/dotty/tools/dotc/typer
1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -224,6 +224,9 @@ object RefChecks {
224
224
* See neg/i12828.scala for an example where this matters.
225
225
* - They overriding/overridden appear in linearization order.
226
226
* See neg/i5094.scala for an example where this matters.
227
+ * - They overriding/overridden appear in linearization order,
228
+ * or the parent is a Java class (because linearization does not apply to java classes).
229
+ * See neg/i5094.scala and pos/i18654.scala for examples where this matters.
227
230
* - The overridden symbol is not `abstract override`. For such symbols
228
231
* we need a more extensive test since the virtual super chain depends
229
232
* on the precise linearization order, which might be different for the
@@ -232,7 +235,7 @@ object RefChecks {
232
235
override def canBeHandledByParent (sym1 : Symbol , sym2 : Symbol , parent : Symbol ): Boolean =
233
236
isOverridingPair(sym1, sym2, parent.thisType)
234
237
.showing(i " already handled ${sym1.showLocated}: ${sym1.asSeenFrom(parent.thisType).signature}, ${sym2.showLocated}: ${sym2.asSeenFrom(parent.thisType).signature} = $result" , refcheck)
235
- && inLinearizationOrder(sym1, sym2, parent)
238
+ && ( inLinearizationOrder(sym1, sym2, parent) || parent.is( JavaDefined ) )
236
239
&& ! sym2.is(AbsOverride )
237
240
238
241
/** Checks the subtype relationship tp1 <:< tp2.
You can’t perform that action at this time.
0 commit comments