File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -224,6 +224,9 @@ object RefChecks {
224224 * See neg/i12828.scala for an example where this matters.
225225 * - They overriding/overridden appear in linearization order.
226226 * 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.
227230 * - The overridden symbol is not `abstract override`. For such symbols
228231 * we need a more extensive test since the virtual super chain depends
229232 * on the precise linearization order, which might be different for the
@@ -232,7 +235,7 @@ object RefChecks {
232235 override def canBeHandledByParent (sym1 : Symbol , sym2 : Symbol , parent : Symbol ): Boolean =
233236 isOverridingPair(sym1, sym2, parent.thisType)
234237 .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 ) )
236239 && ! sym2.is(AbsOverride )
237240
238241 /** Checks the subtype relationship tp1 <:< tp2.
You can’t perform that action at this time.
0 commit comments