File tree 2 files changed +24
-1
lines changed
compiler/src/dotty/tools/dotc/typer 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -804,7 +804,18 @@ class RefChecks extends MiniPhase { thisTransformer =>
804
804
checkOverloadedRestrictions(cls)
805
805
checkParents(cls)
806
806
checkCompanionNameClashes(cls)
807
- checkAllOverrides(cls)
807
+
808
+ def ownerPossibleProblematic (cls : Symbol ) = {
809
+ ! cls.owner.is(Flags .PackageClass ) && cls.owner.isClass &&
810
+ cls.owner.info.baseClasses.exists(_.info.member(cls.name).exists)
811
+ }
812
+
813
+ // If owner is possibly problematic, check owner first.
814
+ // If there are overriding errors with owner, stop checking current to avoid cyclic reference.
815
+ // See neg/i1750.scala.
816
+ if (ownerPossibleProblematic(cls)) checkAllOverrides(cls.owner)
817
+
818
+ if (! ctx.reporter.hasErrors) checkAllOverrides(cls)
808
819
tree
809
820
} catch {
810
821
case ex : MergeError =>
Original file line number Diff line number Diff line change
1
+ trait Lang1 {
2
+ trait Exp
3
+ trait Visitor { def f (left : Exp ): Unit }
4
+ class Eval1 extends Visitor { self =>
5
+ def f (left : Exp ) = ()
6
+ }
7
+ }
8
+
9
+ trait Lang2 extends Lang1 {
10
+ class Visitor extends Eval1 { Visitor => // error: overidding class definitions
11
+ }
12
+ }
You can’t perform that action at this time.
0 commit comments