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

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

Issue 2029193003: Report HintCode.UNUSED_FIELD for fields which are referenced in constructor field initializers. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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/test/dart/ast/ast_test.dart ('k') | no next file » | 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 39752705c06ccf3780e8a592c3452bb3a52d2117..14b46d7805634829eea997aa4ec82d2173a14440 100644
--- a/pkg/analyzer/test/generated/hint_code_test.dart
+++ b/pkg/analyzer/test/generated/hint_code_test.dart
@@ -2886,6 +2886,30 @@ class A {
verify([source]);
}
+ void test_unusedField_notUsed_constructorFieldInitializers() {
+ enableUnusedElement = true;
+ Source source = addSource(r'''
+class A {
+ int _f;
+ A() : _f = 0;
+}''');
+ computeLibrarySourceErrors(source);
+ assertErrors(source, [HintCode.UNUSED_FIELD]);
+ verify([source]);
+ }
+
+ void test_unusedField_notUsed_fieldFormalParameter() {
+ enableUnusedElement = true;
+ Source source = addSource(r'''
+class A {
+ int _f;
+ A(this._f);
+}''');
+ computeLibrarySourceErrors(source);
+ assertErrors(source, [HintCode.UNUSED_FIELD]);
+ verify([source]);
+ }
+
void test_unusedField_notUsed_noReference() {
enableUnusedElement = true;
Source source = addSource(r'''
« no previous file with comments | « pkg/analyzer/test/dart/ast/ast_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698