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

Unified Diff: test/rules/overriden_field.dart

Issue 1870423002: Lint rule: Do not override fields. Base URL: https://github.com/dart-lang/linter.git@master
Patch Set: Hint if a field overrides or hides other field. 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
« no previous file with comments | « lib/src/rules/overriden_field.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/rules/overriden_field.dart
diff --git a/test/rules/overriden_field.dart b/test/rules/overriden_field.dart
new file mode 100644
index 0000000000000000000000000000000000000000..514ee81b4bcf77302f2065261b4a3a6a4bef0060
--- /dev/null
+++ b/test/rules/overriden_field.dart
@@ -0,0 +1,51 @@
+// 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 overriden_field`
+
+class Base {
+ Object field = 'lorem';
+
+ Object something = 'change';
+}
+
+class Bad1 extends Base {
+ @override
+ final x = 1, field = 'ipsum'; // LINT
+}
+
+class Bad2 extends Base {
+ @override
+ Object something = 'done'; // LINT
+}
+
+class Ok extends Base {
+ Object newField; // OK
+
+ final Object newFinal = 'ignore'; // OK
+}
+
+class Super1 {}
+
+class Sub1 extends Super1 {
+ @override
+ int y;
+}
+
+class Super2 {
+ int x, y;
+}
+
+class Sub2 extends Super2 {
+ @override
+ int y; // LINT
+}
+
+class Super3 {
+ int x;
+}
+
+class Sub3 extends Super3 {
+ int x; // LINT
+}
« no previous file with comments | « lib/src/rules/overriden_field.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698