Index: pkg/analysis_server/test/integration/analysis/error_test.dart |
diff --git a/pkg/analysis_server/test/integration/analysis/error_test.dart b/pkg/analysis_server/test/integration/analysis/error_test.dart |
index 25df6566b8c0e75de9b2defbaf3fdcd540dcca40..806958f5e45632b754863412a0de8f644a3e7937 100644 |
--- a/pkg/analysis_server/test/integration/analysis/error_test.dart |
+++ b/pkg/analysis_server/test/integration/analysis/error_test.dart |
@@ -35,4 +35,64 @@ main() { |
expect(errors[0].location.file, equals(pathname)); |
}); |
} |
+ |
+ test_super_mixins_disabled() async { |
+ String pathname = sourcePath('test.dart'); |
+ writeFile( |
+ pathname, |
+ ''' |
+class Test extends Object with C { |
+ void foo() {} |
+} |
+abstract class B { |
+ void foo(); |
+} |
+abstract class C extends B { |
+ void bar() { |
+ super.foo(); |
+ } |
+} |
+'''); |
+ standardAnalysisSetup(); |
+ await analysisFinished; |
+ expect(currentAnalysisErrors[pathname], isList); |
+ List<AnalysisError> errors = currentAnalysisErrors[pathname]; |
+ expect(errors, hasLength(2)); |
+ Set<String> allErrorMessages = |
+ errors.map((AnalysisError e) => e.message).toSet(); |
+ expect( |
+ allErrorMessages, |
+ contains( |
+ "The class 'C' cannot be used as a mixin because it extends a class other than Object")); |
+ expect( |
+ allErrorMessages, |
+ contains( |
+ "The class 'C' cannot be used as a mixin because it references 'super'")); |
+ } |
+ |
+ test_super_mixins_enabled() async { |
+ String pathname = sourcePath('test.dart'); |
+ writeFile( |
+ pathname, |
+ ''' |
+class Test extends Object with C { |
+ void foo() {} |
+} |
+abstract class B { |
+ void foo(); |
+} |
+abstract class C extends B { |
+ void bar() { |
+ super.foo(); |
+ } |
+} |
+'''); |
+ await sendAnalysisUpdateOptions( |
+ new AnalysisOptions()..enableSuperMixins = true); |
+ standardAnalysisSetup(); |
+ await analysisFinished; |
+ expect(currentAnalysisErrors[pathname], isList); |
+ List<AnalysisError> errors = currentAnalysisErrors[pathname]; |
+ expect(errors, isEmpty); |
+ } |
} |