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

Unified Diff: test/rules/always_specify_types.dart

Issue 1880953004: Fix to respect `@optionalTypeArgs` (#196). (Closed) Base URL: https://github.com/dart-lang/linter.git@master
Patch Set: 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/always_specify_types.dart
diff --git a/test/rules/always_specify_types.dart b/test/rules/always_specify_types.dart
index eacb21763ed3780ed1e336e87ff882e7e2922697..ae068ee749c28f8e673d9aef77de77e31416fa04 100644
--- a/test/rules/always_specify_types.dart
+++ b/test/rules/always_specify_types.dart
@@ -2,6 +2,20 @@
// 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.
+
+// Hack to work around issues importing `meta.dart` in tests.
+// Ideally, remove:
+library meta;
+
+class _OptionalTypeArgs {
+ const _OptionalTypeArgs();
+}
+
+const _OptionalTypeArgs optionalTypeArgs = const _OptionalTypeArgs();
+
+// ... and replace w/:
+// import 'package:meta/meta.dart';
+
List list; // LINT
List<List> lists; //LINT
List<int> ints; //OK
@@ -17,6 +31,9 @@ c(int x) {}
d(final x) {} //LINT
e(final int x) {}
+@optionalTypeArgs
+class P<T> { }
+
main() {
var x = ''; //LINT [3:3]
for (var i = 0; i < 10; ++i) { //LINT [8:3]
@@ -42,6 +59,13 @@ main() {
listen((_) { // OK!
// ...
});
+
+ P p = new P(); //OK (optionalTypeArgs)
+}
+
+P doSomething(P p) //OK (optionalTypeArgs)
+{
+ return p;
}
listen(void onData(Object event)) {}
« lib/src/rules/always_specify_types.dart ('K') | « lib/src/rules/always_specify_types.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698