Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(286)

Unified Diff: pkg/kernel/test/class_hierarchy_test.dart

Issue 2998383002: Fix forEachOverridePair in the case where the class in question is abstract. (Closed)
Patch Set: Rebase Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/kernel/lib/src/incremental_class_hierarchy.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/kernel/test/class_hierarchy_test.dart
diff --git a/pkg/kernel/test/class_hierarchy_test.dart b/pkg/kernel/test/class_hierarchy_test.dart
index 054cbd5dae4fa2682512469e78fa06f5087a753e..f57cf02c3ccc72cea5164ab04f3b5134c1b85875 100644
--- a/pkg/kernel/test/class_hierarchy_test.dart
+++ b/pkg/kernel/test/class_hierarchy_test.dart
@@ -288,6 +288,45 @@ class E = self::D with self::A implements self::B {}
_assertOverridePairs(e, ['test::A::foo overrides test::B::foo']);
}
+ /// An abstract member declared in the class is overridden by a member in
+ /// one of the interfaces.
+ void test_forEachOverridePair_supertypeOverridesThis() {
+ var a = addClass(new Class(
+ name: 'A',
+ supertype: objectSuper,
+ procedures: [newEmptyMethod('foo')]));
+ var b = addClass(new Class(
+ name: 'B',
+ supertype: a.asThisSupertype,
+ procedures: [newEmptyMethod('foo', isAbstract: true)]));
+ var c = addClass(new Class(
+ name: 'C',
+ supertype: a.asThisSupertype,
+ procedures: [newEmptyMethod('foo', isAbstract: true)],
+ isAbstract: true));
+
+ _assertTestLibraryText('''
+class A {
+ method foo() → void {}
+}
+class B extends self::A {
+ abstract method foo() → void;
+}
+abstract class C extends self::A {
+ abstract method foo() → void;
+}
+''');
+
+ _assertOverridePairs(b, [
+ 'test::A::foo overrides test::B::foo',
+ 'test::B::foo overrides test::A::foo'
+ ]);
+ _assertOverridePairs(c, [
+ 'test::A::foo overrides test::C::foo',
+ 'test::C::foo overrides test::A::foo'
+ ]);
+ }
+
/// 3. A non-abstract member is inherited from a superclass, and it overrides
/// an abstract member declared in this class.
void test_forEachOverridePair_supertypeOverridesThisAbstract() {
« no previous file with comments | « pkg/kernel/lib/src/incremental_class_hierarchy.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698