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

Unified Diff: pkg/analyzer/test/generated/static_type_warning_code_test.dart

Issue 1650783002: Add tests demonstrating bug #25605. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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 | « no previous file | tests/language/language_analyzer2.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/generated/static_type_warning_code_test.dart
diff --git a/pkg/analyzer/test/generated/static_type_warning_code_test.dart b/pkg/analyzer/test/generated/static_type_warning_code_test.dart
index 2c1e2d27c818dd146f32f6133187f1ceba5ab373..cfab2061b47250297d3bdfa22b40e3c0d87a1912 100644
--- a/pkg/analyzer/test/generated/static_type_warning_code_test.dart
+++ b/pkg/analyzer/test/generated/static_type_warning_code_test.dart
@@ -27,6 +27,79 @@ class StaticTypeWarningCodeTest extends ResolverTestCase {
verify([source]);
}
+ void fail_method_lookup_mixin_of_extends() {
+ // See dartbug.com/25605
+ resetWithOptions(new AnalysisOptionsImpl()..enableSuperMixins = true);
+ Source source = addSource('''
+class A { a() => null; }
+class B {}
+abstract class M extends A {}
+class T = B with M; // Warning: B does not extend A
+main() {
+ new T().a(); // Warning: The method 'a' is not defined for the class 'T'
+}
+''');
+ computeLibrarySourceErrors(source);
+ assertErrors(source, [
+ // TODO(paulberry): when dartbug.com/25614 is fixed, add static warning
+ // code for "B does not extend A".
+ StaticTypeWarningCode.UNDEFINED_METHOD
+ ]);
+ }
+
+ void fail_method_lookup_mixin_of_implements() {
+ // See dartbug.com/25605
+ resetWithOptions(new AnalysisOptionsImpl()..enableSuperMixins = true);
+ Source source = addSource('''
+class A { a() => null; }
+class B {}
+abstract class M implements A {}
+class T = B with M; // Warning: Missing concrete implementation of 'A.a'
+main() {
+ new T().a(); // Warning: The method 'a' is not defined for the class 'T'
+}
+''');
+ computeLibrarySourceErrors(source);
+ assertErrors(source, [
+ StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE,
+ StaticTypeWarningCode.UNDEFINED_METHOD
+ ]);
+ }
+
+ void fail_method_lookup_mixin_of_mixin() {
+ // See dartbug.com/25605
+ resetWithOptions(new AnalysisOptionsImpl()..enableSuperMixins = true);
+ Source source = addSource('''
+class A {}
+class B { b() => null; }
+class C {}
+class M extends A with B {}
+class T = C with M;
+main() {
+ new T().b();
+}
+''');
+ computeLibrarySourceErrors(source);
+ assertErrors(source, [StaticTypeWarningCode.UNDEFINED_METHOD]);
+ }
+
+ void fail_method_lookup_mixin_of_mixin_application() {
+ // See dartbug.com/25605
+ resetWithOptions(new AnalysisOptionsImpl()..enableSuperMixins = true);
+ Source source = addSource('''
+class A { a() => null; }
+class B {}
+class C {}
+class M = A with B;
+class T = C with M;
+main() {
+ new T().a();
+}
+''');
+ computeLibrarySourceErrors(source);
+ assertErrors(source, [StaticTypeWarningCode.UNDEFINED_METHOD]);
+ }
+
void fail_undefinedEnumConstant() {
// We need a way to set the parseEnum flag in the parser to true.
Source source = addSource(r'''
« no previous file with comments | « no previous file | tests/language/language_analyzer2.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698