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

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

Issue 10823389: Start inferring return types for static functions (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments Created 8 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
« no previous file with comments | « lib/compiler/implementation/ssa/codegen.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/return_type_inferer_test.dart
diff --git a/tests/compiler/dart2js/call_site_type_inferer_static_test.dart b/tests/compiler/dart2js/return_type_inferer_test.dart
similarity index 73%
copy from tests/compiler/dart2js/call_site_type_inferer_static_test.dart
copy to tests/compiler/dart2js/return_type_inferer_test.dart
index 3a3a7dd85915788b740f4368b19b576e9d6d58f5..cc83fb1cd45c592bdfd3572dacefa87c9119ae94 100644
--- a/tests/compiler/dart2js/call_site_type_inferer_static_test.dart
+++ b/tests/compiler/dart2js/return_type_inferer_test.dart
@@ -70,30 +70,26 @@ final String TEST_TEN = @"""
main() { f(1); g(f); }
""";
-void runTest(String test, [List<HType> expectedTypes = null]) {
+void runTest(String test, [HType expectedType = HType.UNKNOWN]) {
compileAndFind(
test,
'f',
(backend, x) {
- List<HType> types =
- backend.optimisticParameterTypesWithRecompilationOnTypeChange(x);
- if (expectedTypes != null) {
- Expect.listEquals(expectedTypes, types);
- } else {
- Expect.isNull(types);
- }
+ HType type =
+ backend.optimisticReturnTypesWithRecompilationOnTypeChange(null, x);
+ Expect.equals(expectedType, type);
});
}
void test() {
- runTest(TEST_ONE, [HType.STRING]);
- runTest(TEST_TWO, [HType.INTEGER]);
- runTest(TEST_THREE, [HType.INTEGER]);
- runTest(TEST_FOUR, [HType.DOUBLE]);
- runTest(TEST_FIVE, [HType.NUMBER]);
- runTest(TEST_SIX, [HType.NUMBER]);
+ runTest(TEST_ONE, HType.STRING);
+ runTest(TEST_TWO, HType.INTEGER);
+ runTest(TEST_THREE, HType.INTEGER);
+ runTest(TEST_FOUR, HType.DOUBLE);
+ runTest(TEST_FIVE, HType.NUMBER);
+ runTest(TEST_SIX, HType.NUMBER);
runTest(TEST_SEVEN);
- runTest(TEST_EIGHT, [HType.INTEGER, HType.UNKNOWN]);
+ runTest(TEST_EIGHT, HType.INTEGER);
runTest(TEST_NINE);
runTest(TEST_TEN);
}
« no previous file with comments | « lib/compiler/implementation/ssa/codegen.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698