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

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

Issue 2380863003: fix #27135 and fix #27449 strong mode does not use propagated types (Closed)
Patch Set: Created 4 years, 3 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/src/task/strong/checker_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/src/task/strong/inferred_type_test.dart
diff --git a/pkg/analyzer/test/src/task/strong/inferred_type_test.dart b/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
index 4928bd57857bb729df8ae51add79979f0c6ed8b2..5a0bc4da4bd3dde4464b6eeaec2a8da2ed57b436 100644
--- a/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
+++ b/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
@@ -3613,9 +3613,7 @@ test() {
}
for (dynamic x in list) {
- // The INVALID_ASSIGNMENT hint is because type propagation knows x is
- // a Foo.
- String y = /*info:DYNAMIC_CAST,info:INVALID_ASSIGNMENT*/x;
+ String y = /*info:DYNAMIC_CAST*/x;
}
for (String x in /*error:FOR_IN_OF_INVALID_ELEMENT_TYPE*/list) {
@@ -3624,7 +3622,7 @@ test() {
var z;
for(z in list) {
- String y = /*info:DYNAMIC_CAST,info:INVALID_ASSIGNMENT*/z;
+ String y = /*info:DYNAMIC_CAST*/z;
}
Iterable iter = list;
@@ -3793,6 +3791,27 @@ B v = null;
expect(unit.topLevelVariables[0].type.toString(), 'B<A>');
}
+ void test_lambdaDoesNotHavePropagatedTypeHint() {
+ checkFile(r'''
+List<String> getListOfString() => const <String>[];
+
+void foo() {
+ List myList = getListOfString();
+ myList.map((type) => 42);
+}
+
+void bar() {
+ var list;
+ try {
+ list = <String>[];
+ } catch (_) {
+ return;
+ }
+ /*info:DYNAMIC_INVOKE*/list.map((value) => '$value');
+}
+ ''');
+ }
+
void test_listLiterals() {
checkFile(r'''
test1() {
« no previous file with comments | « pkg/analyzer/test/src/task/strong/checker_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698