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

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: Address comments 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..a014a0fd1e35f221aa8eca8df0fd301bf8b655c1 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,22 @@ class A {
''');
}
+ test_mixinApplicationIsConcrete() {
+ return checkFile(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 {}
+ ''');
+ }
+
test_mixinOverrideOfGrandInterface_interfaceOfAbstractSuperclass() async {
await checkFile('''
class A {}
@@ -3913,6 +3929,52 @@ class B extends A {
''');
}
+ @failingTest
+ test_superMixin_invalidApplication() {
+ // Failing: https://github.com/dart-lang/sdk/issues/30283
+ return checkFile(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 {}
+}
+ ''', superMixins: true);
+ }
+
+ test_superMixinsMakeSuperclassMethodsAbstract() {
+ return checkFile(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 {}
+ ''', superMixins: true);
+ }
+
test_tearOffTreatedConsistentlyAsStrictArrow() async {
await checkFile(r'''
void foo(void f(String x)) {}
« no previous file with comments | « pkg/analyzer/lib/src/task/strong/checker.dart ('k') | pkg/analyzer/test/src/task/strong/inferred_type_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698