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

Unified Diff: pkg/analyzer/test/src/task/strong/checker_test.dart

Issue 2986063002: Avoid issuing incorrect errors when super mixins are enabled (Closed)
Patch Set: Coment Created 3 years, 5 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
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 ff40070a001e89095321283bdebcc49f80d672de..3b51e0e8e270393898b955eddf33479f8565eed5 100644
--- a/pkg/analyzer/test/src/task/strong/checker_test.dart
+++ b/pkg/analyzer/test/src/task/strong/checker_test.dart
@@ -2639,6 +2639,22 @@ class C2 extends Object with M2 {
''');
}
+ test_interfacesFromMixinsOnlyConsiderMostDerivedMember() {
+ // Regression test for dart2js interface pattern in strong mode.
+ return checkFile(r'''
+abstract class I1 { num get x; }
+abstract class I2 extends I1 { int get x; }
+
+class M1 { num get x => 0; }
+class M2 { int get x => 0; }
+
+class Base extends Object with M1 implements I1 {}
+class Child extends Base with M2 implements I2 {}
+
+class C extends Object with M1, M2 implements I1, I2 {}
+ ''');
+ }
+
test_interfacesFromMixinsUsedTwiceAreChecked() {
// Regression test for https://github.com/dart-lang/sdk/issues/29782
return checkFile(r'''
@@ -2661,22 +2677,6 @@ class F extends D with M<int> {
''');
}
- test_interfacesFromMixinsOnlyConsiderMostDerivedMember() {
- // Regression test for dart2js interface pattern in strong mode.
- return checkFile(r'''
-abstract class I1 { num get x; }
-abstract class I2 extends I1 { int get x; }
-
-class M1 { num get x => 0; }
-class M2 { int get x => 0; }
-
-class Base extends Object with M1 implements I1 {}
-class Child extends Base with M2 implements I2 {}
-
-class C extends Object with M1, M2 implements I1, I2 {}
- ''');
- }
-
test_invalidOverrides_baseClassOverrideToChildInterface() async {
await checkFile('''
class A {}
@@ -3170,6 +3170,23 @@ class A {
''');
}
+ test_mixinApplicationIsConcrete() async {
Jennifer Messerly 2017/07/27 21:07:58 style thing: existing tests in this file often use
Leaf 2017/07/27 21:38:09 Done.
+ addFile(r'''
+class A {
+ int get foo => 3;
+}
+
+class B {
+ num get foo => 3.0;
+}
+
+class C = Object with B;
+
+class D extends Object with /*error:INVALID_METHOD_OVERRIDE_FROM_MIXIN*/C implements A {}
+ ''');
+ await check();
+ }
+
test_mixinOverrideOfGrandInterface_interfaceOfAbstractSuperclass() async {
await checkFile('''
class A {}
@@ -3913,6 +3930,54 @@ class B extends A {
''');
}
+ @failingTest
+ test_superMixin_invalidApplication() async {
Jennifer Messerly 2017/07/27 21:07:58 (same comment from above would apply to these test
Leaf 2017/07/27 21:38:09 Done.
+ //Failing: https://github.com/dart-lang/sdk/issues/30283
Jennifer Messerly 2017/07/27 21:07:58 trivia nit: space after "//"
Leaf 2017/07/27 21:38:09 Done.
+ addFile(r'''
+ class A {
+ int get foo => 3;
+}
+
+// This expects a super class which satisfies the contract of A
+class B extends A {}
+
+class C {
+ num get foo => null;
+}
+
+// This mixin application doesn't provide a valid superclass for B
+class D extends C with /*error:INCONSISTENT_METHOD_INHERITANCE*/B {}
+}
+ ''');
+ await check(superMixins: true);
+ }
+
+ test_superMixinsMakeSuperclassMethodsAbstract() async {
+ addFile(r'''
+ abstract class A {}
+
+abstract class B extends A {}
+
+abstract class ProvidesConcreteAGetter {
+ A get constraints => null;
+}
+
+abstract class ProvidesConcreteBGetter extends ProvidesConcreteAGetter {
+ @override
+ B get constraints => null;
+}
+
+abstract class ProvidesAbstractBGetter implements ProvidesConcreteBGetter {}
+
+abstract class ProvidesAbstractAGetterMixin extends ProvidesConcreteAGetter {}
+
+abstract class HasConcreteBGetterButMixesinAbstractAGetter
+ extends ProvidesConcreteBGetter
+ with ProvidesAbstractAGetterMixin, ProvidesAbstractBGetter {}
+ ''');
+ await check(superMixins: true);
+ }
+
test_tearOffTreatedConsistentlyAsStrictArrow() async {
await checkFile(r'''
void foo(void f(String x)) {}

Powered by Google App Engine
This is Rietveld 408576698