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

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

Issue 2182773002: Issue 26787. Report HintCode.OVERRIDE_ON_NON_OVERRIDING_GETTER for non-overriding fields. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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
« no previous file with comments | « pkg/analyzer/lib/src/generated/resolver.dart ('k') | pkg/analyzer/test/generated/non_hint_code_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/generated/hint_code_test.dart
diff --git a/pkg/analyzer/test/generated/hint_code_test.dart b/pkg/analyzer/test/generated/hint_code_test.dart
index 6644ccd66f82d17f6c72deb7abfe0e372b9224b4..acaeaf9de7037079ff27ddb77b4cd5ceafaeb944 100644
--- a/pkg/analyzer/test/generated/hint_code_test.dart
+++ b/pkg/analyzer/test/generated/hint_code_test.dart
@@ -1359,31 +1359,31 @@ main() {
verify([source, source2]);
}
- void test_invalidUseOfProtectedMember_function_OK2() {
+ void test_invalidUseOfProtectedMember_function_OK() {
Source source = addSource(r'''
import 'package:meta/meta.dart';
class A {
@protected
- void a(){ }
+ int a() => 0;
}
-main() {
- new A().a();
+
+abstract class B implements A {
+ int b() => a();
}''');
computeLibrarySourceErrors(source);
assertNoErrors(source);
verify([source]);
}
- void test_invalidUseOfProtectedMember_function_OK() {
+ void test_invalidUseOfProtectedMember_function_OK2() {
Source source = addSource(r'''
import 'package:meta/meta.dart';
class A {
@protected
- int a() => 0;
+ void a(){ }
}
-
-abstract class B implements A {
- int b() => a();
+main() {
+ new A().a();
}''');
computeLibrarySourceErrors(source);
assertNoErrors(source);
@@ -2047,6 +2047,21 @@ m(x) {
verify([source]);
}
+ void test_overrideOnNonOverridingGetter_field_invalid() {
+ Source source = addSource(r'''
+library dart.core;
+const override = null;
+class A {
+}
+class B extends A {
+ @override
+ final int m = 1;
+}''');
+ computeLibrarySourceErrors(source);
+ assertErrors(source, [HintCode.OVERRIDE_ON_NON_OVERRIDING_GETTER]);
+ verify([source]);
+ }
+
void test_overrideOnNonOverridingGetter_invalid() {
Source source = addSource(r'''
library dart.core;
« no previous file with comments | « pkg/analyzer/lib/src/generated/resolver.dart ('k') | pkg/analyzer/test/generated/non_hint_code_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698