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

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

Issue 17151007: Eagerly infer the element type of const lists in the simple inferrer. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 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 | « tests/compiler/dart2js/mock_compiler.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_test.dart
===================================================================
--- tests/compiler/dart2js/simple_inferrer_test.dart (revision 24128)
+++ tests/compiler/dart2js/simple_inferrer_test.dart (working copy)
@@ -351,6 +351,16 @@
return b;
}
+testReturnElementOfConstList1() {
+ return const [42][0];
+}
+
+testReturnElementOfConstList2() {
+ return topLevelConstList[0];
+}
+
+var topLevelConstList = const [42];
+
get topLevelGetter => 42;
returnDynamic() => topLevelGetter(42);
returnTopLevelGetter() => topLevelGetter;
@@ -455,6 +465,8 @@
..returnInt7()
..returnInt8()
..returnInt9();
+ testReturnElementOfConstList1();
+ testReturnElementOfConstList2();
}
""";
@@ -527,6 +539,8 @@
checkReturn('testBreak1', interceptorType.nullable());
checkReturn('testContinue2', interceptorType.nullable());
checkReturn('testBreak2', typesInferrer.intType.nullable());
+ checkReturn('testReturnElementOfConstList1', typesInferrer.intType);
+ checkReturn('testReturnElementOfConstList2', typesInferrer.intType);
checkReturnInClass(String className, String methodName, type) {
var cls = findElement(compiler, className);
« no previous file with comments | « tests/compiler/dart2js/mock_compiler.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698