Index: pkg/analyzer/test/src/task/strong/checker_test.dart |
diff --git a/pkg/analyzer/test/src/task/strong/checker_test.dart b/pkg/analyzer/test/src/task/strong/checker_test.dart |
index a35ef8cdcab7e80fa617df1d801fd570a5cc81fe..4b2d886ae5832e48f198c45911ff9b4a787f2bb9 100644 |
--- a/pkg/analyzer/test/src/task/strong/checker_test.dart |
+++ b/pkg/analyzer/test/src/task/strong/checker_test.dart |
@@ -2478,6 +2478,41 @@ dynamic y1 = (<dynamic>[])[0]; |
await check(implicitDynamic: false); |
} |
+ test_interfaceOverridesAreAllChecked() { |
+ // Regression test for https://github.com/dart-lang/sdk/issues/29766 |
+ return checkFile(r''' |
+class B { |
+ set x(int y) {} |
+} |
+class C { |
+ set x(Object y) {} |
+} |
+class D implements B, C { |
+ /*error:INVALID_METHOD_OVERRIDE*/int x; |
+} |
+ '''); |
+ } |
+ |
+ test_interfacesFromMixinsAreChecked() { |
+ // Regression test for https://github.com/dart-lang/sdk/issues/29782 |
+ return checkFile(r''' |
+abstract class I { |
+ set x(int v); |
+} |
+abstract class M implements I {} |
+ |
+class C extends Object with M { |
+ /*error:INVALID_METHOD_OVERRIDE*/String x; |
+} |
+ |
+abstract class M2 = Object with M; |
+ |
+class C2 extends Object with M2 { |
+ /*error:INVALID_METHOD_OVERRIDE*/String x; |
+} |
+ '''); |
+ } |
+ |
test_invalidOverrides_baseClassOverrideToChildInterface() async { |
await checkFile(''' |
class A {} |
@@ -3324,21 +3359,24 @@ class D extends B implements A { } |
'''); |
} |
- test_overrideNarrowsType_noDuplicateError() async { |
+ test_overrideNarrowsType_noDuplicateError() { |
// Regression test for https://github.com/dart-lang/sdk/issues/25232 |
- _addMetaLibrary(); |
- await checkFile(r''' |
-import 'meta.dart'; |
+ return checkFile(r''' |
abstract class A { void test(A arg) { } } |
abstract class B extends A { |
/*error:INVALID_METHOD_OVERRIDE*/void test(B arg) { } |
} |
abstract class X implements A { } |
-class C extends B with X { } |
+ |
+class C extends B {} |
+ |
+// We treat "with X" as asking for another check. |
+// This feels inconsistent. |
+class D /*error:INVALID_METHOD_OVERRIDE_FROM_BASE*/extends B with X { } |
// We treat "implements A" as asking for another check. |
-// This feels inconsistent to me. |
-class D /*error:INVALID_METHOD_OVERRIDE_FROM_BASE*/extends B implements A { } |
+// This feels inconsistent. |
+class E /*error:INVALID_METHOD_OVERRIDE_FROM_BASE*/extends B implements A { } |
'''); |
} |