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

Unified Diff: pkg/analyzer/test/src/task/strong/checker_test.dart

Issue 2801683004: Reify implicit casts for FutureOr (Closed)
Patch Set: Add back FutureOr case Created 3 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: pkg/analyzer/test/src/task/strong/checker_test.dart
diff --git a/pkg/analyzer/test/src/task/strong/checker_test.dart b/pkg/analyzer/test/src/task/strong/checker_test.dart
index 4ac3e49b826f8e83da769e4ed2850a9a84ac4bc8..396374ef79d85fa9cfa1778dda53045d761e89b4 100644
--- a/pkg/analyzer/test/src/task/strong/checker_test.dart
+++ b/pkg/analyzer/test/src/task/strong/checker_test.dart
@@ -921,14 +921,14 @@ dynamic x;
foo1() async => x;
Future foo2() async => x;
-Future<int> foo3() async => x;
+Future<int> foo3() async => /*info:DYNAMIC_CAST*/x;
Future<int> foo4() async => new Future<int>.value(x);
Future<int> foo5() async =>
/*error:RETURN_OF_INVALID_TYPE*/new Future<String>.value(x);
bar1() async { return x; }
Future bar2() async { return x; }
-Future<int> bar3() async { return x; }
+Future<int> bar3() async { return /*info:DYNAMIC_CAST*/x; }
Future<int> bar4() async { return new Future<int>.value(x); }
Future<int> bar5() async {
return /*error:RETURN_OF_INVALID_TYPE*/new Future<String>.value(x);
@@ -955,7 +955,7 @@ Future<bool> get issue_ddc_264 async {
Future<String> issue_sdk_26404() async {
- return (1 > 0) ? new Future<String>.value('hello') : "world";
+ return (/*info:DOWN_CAST_COMPOSITE*/(1 > 0) ? new Future<String>.value('hello') : "world");
}
''');
}
@@ -2197,13 +2197,22 @@ main() {
test_implicitCasts() async {
addFile('num n; int i = /*info:ASSIGNMENT_CAST*/n;');
await check();
- // TODO(jmesserly): should not be emitting the hint as well as the error.
- // It is a "strong mode hint" however, so it will not be user visible.
- addFile(
- 'num n; int i = /*info:ASSIGNMENT_CAST,error:INVALID_ASSIGNMENT*/n;');
+ addFile('num n; int i = /*error:INVALID_ASSIGNMENT*/n;');
await check(implicitCasts: false);
}
+ test_implicitCasts_return() async {
+ addFile(r'''
+import 'dart:async';
+
+Future<List<String>> foo() async {
+ List<Object> x = <Object>["hello", "world"];
+ return /*info:DOWN_CAST_IMPLICIT*/x;
+}
+ ''');
+ await check();
+ }
+
test_implicitCasts_genericMethods() async {
addFile('''
var x = <String>[].map<String>((x) => "");
« no previous file with comments | « pkg/analyzer/lib/src/task/strong/checker.dart ('k') | pkg/analyzer/test/src/task/strong/inferred_type_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698