Index: pkg/analyzer/lib/src/task/strong/checker.dart |
diff --git a/pkg/analyzer/lib/src/task/strong/checker.dart b/pkg/analyzer/lib/src/task/strong/checker.dart |
index 26b9fa1cfce3f487db3070e0771e7a88e3191a0c..9e5eee90c4cb3e4420fd9d920023c7b270c85c74 100644 |
--- a/pkg/analyzer/lib/src/task/strong/checker.dart |
+++ b/pkg/analyzer/lib/src/task/strong/checker.dart |
@@ -1289,14 +1289,19 @@ class _OverrideChecker { |
// Check also how we override locally the interfaces from parent classes if |
// the parent class is abstract. Otherwise, these will be checked as |
// overrides on the concrete superclass. |
+ // We detect superclass circularities using the "tortoise and hare" |
+ // algorithm. |
var superInterfaces = new Set<InterfaceType>(); |
var parent = type.superclass; |
+ var hare = type.superclass?.superclass; |
// TODO(sigmund): we don't seem to be reporting the analyzer error that a |
// non-abstract class is not implementing an interface. See |
// https://github.com/dart-lang/dart-dev-compiler/issues/25 |
while (parent != null && parent.element.isAbstract) { |
+ if (identical(parent, hare)) break; |
parent.interfaces.forEach((i) => find(i, superInterfaces)); |
parent = parent.superclass; |
+ hare = hare?.superclass?.superclass; |
} |
_checkInterfacesOverrides(type, superInterfaces, seen, |
includeParents: false, classNode: node); |