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

Side by Side Diff: tests/compiler/dart2js/simple_inferrer_test.dart

Issue 23565007: Make sure we're not trying to optimize an int check if the input can be a number. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'package:expect/expect.dart'; 5 import 'package:expect/expect.dart';
6 import 6 import
7 '../../../sdk/lib/_internal/compiler/implementation/types/types.dart' 7 '../../../sdk/lib/_internal/compiler/implementation/types/types.dart'
8 show TypeMask; 8 show TypeMask;
9 9
10 import 'compiler_helper.dart'; 10 import 'compiler_helper.dart';
11 import 'parser_helper.dart'; 11 import 'parser_helper.dart';
12 12
13 const String TEST = """ 13 const String TEST = """
14 returnNum1(a) { 14 returnNum1(a) {
15 if (a) return 1; 15 if (a) return 1;
16 else return 2.0; 16 else return 2.5;
17 } 17 }
18 18
19 returnNum2(a) { 19 returnNum2(a) {
20 if (a) return 1.0; 20 if (a) return 1.4;
21 else return 2; 21 else return 2;
22 } 22 }
23 23
24 returnInt1(a) { 24 returnInt1(a) {
25 if (a) return 1; 25 if (a) return 1;
26 else return 2; 26 else return 2;
27 } 27 }
28 28
29 returnDouble(a) { 29 returnDouble(a) {
30 if (a) return 1.0; 30 if (a) return 1.5;
31 else return 2.0; 31 else return 2.5;
32 } 32 }
33 33
34 returnGiveUp(a) { 34 returnGiveUp(a) {
35 if (a) return 1; 35 if (a) return 1;
36 else return 'foo'; 36 else return 'foo';
37 } 37 }
38 38
39 returnInt2() { 39 returnInt2() {
40 var a = 42; 40 var a = 42;
41 return a++; 41 return a++;
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 } 710 }
711 checkFactoryConstructor('A', ''); 711 checkFactoryConstructor('A', '');
712 712
713 checkReturn('testCascade1', typesTask.growableListType); 713 checkReturn('testCascade1', typesTask.growableListType);
714 checkReturn('testCascade2', new TypeMask.nonNullExact( 714 checkReturn('testCascade2', new TypeMask.nonNullExact(
715 typesTask.rawTypeOf(findElement(compiler, 'CascadeHelper')))); 715 typesTask.rawTypeOf(findElement(compiler, 'CascadeHelper'))));
716 checkReturn('testSpecialization1', typesTask.numType); 716 checkReturn('testSpecialization1', typesTask.numType);
717 checkReturn('testSpecialization2', typesTask.dynamicType); 717 checkReturn('testSpecialization2', typesTask.dynamicType);
718 checkReturn('testSpecialization3', typesTask.intType.nullable()); 718 checkReturn('testSpecialization3', typesTask.intType.nullable());
719 } 719 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/mock_compiler.dart ('k') | tests/compiler/dart2js_extra/inferrer_is_int_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698