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

Unified Diff: test/rules/final_override_non_final.dart

Issue 1870423002: Lint rule: Do not override fields. Base URL: https://github.com/dart-lang/linter.git@master
Patch Set: Hint field override Created 4 years, 8 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: test/rules/final_override_non_final.dart
diff --git a/test/rules/final_override_non_final.dart b/test/rules/final_override_non_final.dart
new file mode 100644
index 0000000000000000000000000000000000000000..e9acf9795c81cb55da404e6ddaa97537ed6e0d9d
--- /dev/null
+++ b/test/rules/final_override_non_final.dart
@@ -0,0 +1,27 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+// test w/ `dart test/util/solo_test.dart final_override_non_final`
+
+class Base {
+ Object field = 'lorem';
+
+ Object something = 'change';
+}
+
+class Bad1 extends Base {
+ @override
+ final field = 'ipsum'; // LINT
+}
+
+class Bad2 extends Base {
+ @override
+ Object something = 'done'; // LINT
+}
+
+class Ok extends Base {
+ Object newField; // OK
+
+ final Object newFinal = 'ignore'; // OK
+}
« lib/src/rules/final_override_non_final.dart ('K') | « lib/src/rules/final_override_non_final.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698