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

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

Issue 16077015: Rip-off the backend type 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/field_type_inferer_test.dart ('k') | tests/language/inferrer_constructor3_test.dart » ('j') | 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
===================================================================
--- tests/compiler/dart2js/return_type_inferer_test.dart (revision 23797)
+++ tests/compiler/dart2js/return_type_inferer_test.dart (working copy)
@@ -1,97 +0,0 @@
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import "package:expect/expect.dart";
-import '../../../sdk/lib/_internal/compiler/implementation/ssa/ssa.dart';
-
-import 'compiler_helper.dart';
-
-const String TEST_ONE = r"""
- f(p) { if (p == null) return p; else return p; }
- main() { f("s"); }
-""";
-
-const String TEST_TWO = r"""
- f(p) { if (p == null) return p; else return p; }
- main() { f(1); }
-""";
-
-const String TEST_THREE = r"""
- f(p) { if (p == null) return p; else return p; }
- main() { f(1); f(2); }
-""";
-
-const String TEST_FOUR = r"""
- f(p) { if (p == null) return p; else return p; }
- main() { f(1.1); }
-""";
-
-const String TEST_FIVE = r"""
- f(p) { if (p == null) return p; else return p; }
- main() { f(1); f(2.2); }
-""";
-
-const String TEST_SIX = r"""
- f(p) { if (p == null) return p; else return p; }
- main() { f(1.1); f(2); }
-""";
-
-const String TEST_SEVEN = r"""
- f(p) { if (p == null) return p; else return p; }
- main() { f(1); f("s"); }
-""";
-
-const String TEST_EIGHT = r"""
- f(p1, p2) {
- if (p1 == null) return p1;
- else return p1;
- }
- main() { f(1, 2); f(1, "s"); }
-""";
-
-const String TEST_NINE = r"""
- f(p1, p2) {
- if (p1 == null) return p1;
- else return p1;
- }
- main() { f("s", 2); f(1, "s"); }
-""";
-
-const String TEST_TEN = r"""
- f(p) { if (p == null) return p; else return p; }
- g(p) { if (p == null) return p; else return p; }
- main() { f(1); g(f); }
-""";
-
-void runTest(String test, Function findExpectedType) {
- compileAndCheck(
- test,
- 'f',
- (compiler, x) {
- var backend = compiler.backend;
- HType type =
- backend.optimisticReturnTypesWithRecompilationOnTypeChange(null, x);
- Expect.equals(findExpectedType(compiler), type.simplify(compiler));
- });
-}
-
-void test() {
- subclassOfInterceptor(compiler) =>
- findHType(compiler, 'Interceptor', 'nonNullSubclass');
-
- runTest(TEST_ONE, (compiler) => HType.STRING);
- runTest(TEST_TWO, (compiler) => HType.INTEGER);
- runTest(TEST_THREE, (compiler) => HType.INTEGER);
- runTest(TEST_FOUR, (compiler) => HType.DOUBLE);
- runTest(TEST_FIVE, (compiler) => HType.NUMBER);
- runTest(TEST_SIX, (compiler) => HType.NUMBER);
- runTest(TEST_SEVEN, subclassOfInterceptor);
- runTest(TEST_EIGHT, (compiler) => HType.INTEGER);
- runTest(TEST_NINE, subclassOfInterceptor);
- runTest(TEST_TEN, (compiler) => HType.UNKNOWN);
-}
-
-void main() {
- test();
-}
« no previous file with comments | « tests/compiler/dart2js/field_type_inferer_test.dart ('k') | tests/language/inferrer_constructor3_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698