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

Unified Diff: tests/compiler/dart2js/simple_inferrer_closure_test.dart

Issue 19784005: Cleanup in the type inferrer. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 5 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 | « sdk/lib/_internal/compiler/implementation/types/simple_types_inferrer.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/simple_inferrer_closure_test.dart
===================================================================
--- tests/compiler/dart2js/simple_inferrer_closure_test.dart (revision 25331)
+++ tests/compiler/dart2js/simple_inferrer_closure_test.dart (working copy)
@@ -17,7 +17,7 @@
returnDyn1() {
var a = 42;
var f = () {
- a = 'foo';
+ a = {};
};
return a;
}
@@ -36,7 +36,7 @@
a = 54;
};
var g = () {
- a = 'foo';
+ a = {};
};
return a;
}
@@ -55,7 +55,7 @@
var a = 42;
if (a == 53) {
var f = () {
- a = 'foo';
+ a = {};
};
}
return a;
@@ -67,6 +67,20 @@
return g();
}
+returnNum1() {
+ var a = 42.5;
+ try {
+ g() {
+ var b = {};
+ b = 42;
+ return b;
+ }
+ a = g();
+ } finally {
+ }
+ return a;
+}
+
main() {
returnInt1();
returnDyn1();
@@ -75,6 +89,7 @@
returnInt3();
returnDyn3();
returnInt4();
+ returnNum1();
}
""";
@@ -87,18 +102,17 @@
checkReturn(String name, type) {
var element = findElement(compiler, name);
- Expect.equals(type, typesInferrer.getReturnTypeOfElement(element));
+ Expect.equals(type,
+ typesInferrer.getReturnTypeOfElement(element).simplify(compiler));
}
checkReturn('returnInt1', compiler.typesTask.intType);
- // TODO(ngeoffray): We don't use types of mutated captured
- // variables anymore, because they could lead to optimistic results
- // needing to be re-analyzed.
- checkReturn('returnInt2', compiler.typesTask.dynamicType);
+ checkReturn('returnInt2', compiler.typesTask.intType.nullable());
checkReturn('returnInt3', compiler.typesTask.intType);
checkReturn('returnInt4', compiler.typesTask.intType);
checkReturn('returnDyn1', compiler.typesTask.dynamicType);
checkReturn('returnDyn2', compiler.typesTask.dynamicType);
checkReturn('returnDyn3', compiler.typesTask.dynamicType);
+ checkReturn('returnNum1', compiler.typesTask.numType);
}
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/types/simple_types_inferrer.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698