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

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

Issue 22955003: Fix inference bugs found by sra@ by changing how we merge if/then/else locals. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 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: tests/compiler/dart2js/simple_inferrer_test.dart
===================================================================
--- tests/compiler/dart2js/simple_inferrer_test.dart (revision 26109)
+++ tests/compiler/dart2js/simple_inferrer_test.dart (working copy)
@@ -233,6 +233,24 @@
}
}
+testIf1(a) {
+ var c = null;
+ if (a) {
+ c = 10;
+ } else {
+ }
+ return c;
+}
+
+testIf2(a) {
+ var c = null;
+ if (a) {
+ } else {
+ c = 10;
+ }
+ return c;
+}
+
returnAsString() {
return topLevelGetter() as String;
}
@@ -487,6 +505,8 @@
testIsCheck18(topLevelGetter());
testIsCheck19(topLevelGetter());
testIsCheck20();
+ testIf1(topLevelGetter());
+ testIf2(topLevelGetter());
returnAsString();
returnIntAsNum();
returnAsTypedef();
@@ -584,6 +604,8 @@
checkReturn('testIsCheck18', typesTask.dynamicType);
checkReturn('testIsCheck19', typesTask.dynamicType);
checkReturn('testIsCheck20', typesTask.dynamicType.nonNullable());
+ checkReturn('testIf1', typesTask.intType.nullable());
+ checkReturn('testIf2', typesTask.intType.nullable());
checkReturn('returnAsString',
new TypeMask.subtype(compiler.stringClass.computeType(compiler)));
checkReturn('returnIntAsNum', typesTask.intType);

Powered by Google App Engine
This is Rietveld 408576698