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

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

Issue 94463002: More unit test fixes after IR returns different int types for inferrer. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years 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
« no previous file with comments | « tests/compiler/dart2js/field_type_simple_inferer_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "package:async_helper/async_helper.dart"; 6 import "package:async_helper/async_helper.dart";
7 import 7 import
8 '../../../sdk/lib/_internal/compiler/implementation/types/types.dart' 8 '../../../sdk/lib/_internal/compiler/implementation/types/types.dart'
9 show TypeMask; 9 show TypeMask;
10 10
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 checkReturn('testIsCheck26', intType); 760 checkReturn('testIsCheck26', intType);
761 checkReturn('testIsCheck27', intType); 761 checkReturn('testIsCheck27', intType);
762 checkReturn('testIsCheck28', typesTask.dynamicType); 762 checkReturn('testIsCheck28', typesTask.dynamicType);
763 checkReturn('testIsCheck29', typesTask.dynamicType); 763 checkReturn('testIsCheck29', typesTask.dynamicType);
764 checkReturn('testIf1', typesTask.uint31Type.nullable()); 764 checkReturn('testIf1', typesTask.uint31Type.nullable());
765 checkReturn('testIf2', typesTask.uint31Type.nullable()); 765 checkReturn('testIf2', typesTask.uint31Type.nullable());
766 checkReturn('returnAsString', 766 checkReturn('returnAsString',
767 new TypeMask.subtype(compiler.stringClass)); 767 new TypeMask.subtype(compiler.stringClass));
768 checkReturn('returnIntAsNum', typesTask.uint31Type); 768 checkReturn('returnIntAsNum', typesTask.uint31Type);
769 checkReturn('returnAsTypedef', typesTask.functionType.nullable()); 769 checkReturn('returnAsTypedef', typesTask.functionType.nullable());
770 checkReturn('returnTopLevelGetter', typesTask.intType); 770 checkReturn('returnTopLevelGetter', typesTask.uint31Type);
771 checkReturn('testDeadCode', typesTask.intType); 771 checkReturn('testDeadCode', typesTask.uint31Type);
772 checkReturn('testLabeledIf', typesTask.uint31Type.nullable()); 772 checkReturn('testLabeledIf', typesTask.uint31Type.nullable());
773 checkReturn('testSwitch1', typesTask.intType 773 checkReturn('testSwitch1', typesTask.intType
774 .union(typesTask.doubleType, compiler) 774 .union(typesTask.doubleType, compiler)
775 .nullable().simplify(compiler)); 775 .nullable().simplify(compiler));
776 checkReturn('testSwitch2', typesTask.uint31Type); 776 checkReturn('testSwitch2', typesTask.uint31Type);
777 checkReturn('testSwitch3', interceptorType.nullable()); 777 checkReturn('testSwitch3', interceptorType.nullable());
778 checkReturn('testSwitch4', typesTask.uint31Type); 778 checkReturn('testSwitch4', typesTask.uint31Type);
779 checkReturn('testSwitch5', typesTask.uint31Type); 779 checkReturn('testSwitch5', typesTask.uint31Type);
780 checkReturn('testContinue1', interceptorType.nullable()); 780 checkReturn('testContinue1', interceptorType.nullable());
781 checkReturn('testBreak1', interceptorType.nullable()); 781 checkReturn('testBreak1', interceptorType.nullable());
782 checkReturn('testContinue2', interceptorType.nullable()); 782 checkReturn('testContinue2', interceptorType.nullable());
783 checkReturn('testBreak2', typesTask.intType.nullable()); 783 checkReturn('testBreak2', typesTask.intType.nullable());
784 checkReturn('testReturnElementOfConstList1', typesTask.uint31Type); 784 checkReturn('testReturnElementOfConstList1', typesTask.uint31Type);
785 checkReturn('testReturnElementOfConstList2', typesTask.uint31Type); 785 checkReturn('testReturnElementOfConstList2', typesTask.uint31Type);
786 checkReturn('testReturnItselfOrInt', typesTask.uint31Type); 786 checkReturn('testReturnItselfOrInt', typesTask.uint31Type);
787 checkReturn('testReturnInvokeDynamicGetter', typesTask.dynamicType); 787 checkReturn('testReturnInvokeDynamicGetter', typesTask.dynamicType);
788 788
789 checkReturn('testDoWhile1', typesTask.stringType); 789 checkReturn('testDoWhile1', typesTask.stringType);
790 checkReturn('testDoWhile2', typesTask.nullType); 790 checkReturn('testDoWhile2', typesTask.nullType);
791 checkReturn('testDoWhile3', typesTask.uint31Type); 791 checkReturn('testDoWhile3', typesTask.uint31Type);
792 checkReturn('testDoWhile4', typesTask.numType); 792 checkReturn('testDoWhile4', typesTask.numType);
793 793
794 checkReturnInClass(String className, String methodName, type) { 794 checkReturnInClass(String className, String methodName, type) {
795 var cls = findElement(compiler, className); 795 var cls = findElement(compiler, className);
796 var element = cls.lookupLocalMember(methodName); 796 var element = cls.lookupLocalMember(methodName);
797 Expect.equals(type, 797 Expect.equals(type,
798 typesInferrer.getReturnTypeOfElement(element).simplify(compiler)); 798 typesInferrer.getReturnTypeOfElement(element).simplify(compiler),
799 '$className:$methodName');
799 } 800 }
800 801
801 checkReturnInClass('A', 'returnInt1', typesTask.intType); 802 checkReturnInClass('A', 'returnInt1', typesTask.intType);
802 checkReturnInClass('A', 'returnInt2', typesTask.intType); 803 checkReturnInClass('A', 'returnInt2', typesTask.intType);
803 checkReturnInClass('A', 'returnInt3', typesTask.intType); 804 checkReturnInClass('A', 'returnInt3', typesTask.intType);
804 checkReturnInClass('A', 'returnInt4', typesTask.intType); 805 checkReturnInClass('A', 'returnInt4', typesTask.intType);
805 checkReturnInClass('A', 'returnInt5', typesTask.intType); 806 checkReturnInClass('A', 'returnInt5', typesTask.intType);
806 checkReturnInClass('A', 'returnInt6', typesTask.intType); 807 checkReturnInClass('A', 'returnInt6', typesTask.intType);
807 checkReturnInClass('A', '==', interceptorType); 808 checkReturnInClass('A', '==', interceptorType);
808 809
809 checkReturnInClass('B', 'returnInt1', typesTask.intType); 810 checkReturnInClass('B', 'returnInt1', typesTask.intType);
810 checkReturnInClass('B', 'returnInt2', typesTask.intType); 811 checkReturnInClass('B', 'returnInt2', typesTask.intType);
811 checkReturnInClass('B', 'returnInt3', typesTask.intType); 812 checkReturnInClass('B', 'returnInt3', typesTask.intType);
812 checkReturnInClass('B', 'returnInt4', typesTask.intType); 813 checkReturnInClass('B', 'returnInt4', typesTask.intType);
813 checkReturnInClass('B', 'returnInt5', typesTask.intType); 814 checkReturnInClass('B', 'returnInt5', typesTask.intType);
814 checkReturnInClass('B', 'returnInt6', typesTask.intType); 815 checkReturnInClass('B', 'returnInt6', typesTask.intType);
815 checkReturnInClass('B', 'returnInt7', typesTask.intType); 816 checkReturnInClass('B', 'returnInt7', typesTask.intType);
816 checkReturnInClass('B', 'returnInt8', typesTask.intType); 817 checkReturnInClass('B', 'returnInt8', typesTask.intType);
817 checkReturnInClass('B', 'returnInt9', typesTask.intType); 818 checkReturnInClass('B', 'returnInt9', typesTask.uint31Type);
818 819
819 checkFactoryConstructor(String className, String factoryName) { 820 checkFactoryConstructor(String className, String factoryName) {
820 var cls = findElement(compiler, className); 821 var cls = findElement(compiler, className);
821 var element = cls.localLookup(factoryName); 822 var element = cls.localLookup(factoryName);
822 Expect.equals(new TypeMask.nonNullExact(cls), 823 Expect.equals(new TypeMask.nonNullExact(cls),
823 typesInferrer.getReturnTypeOfElement(element)); 824 typesInferrer.getReturnTypeOfElement(element));
824 } 825 }
825 checkFactoryConstructor('A', ''); 826 checkFactoryConstructor('A', '');
826 827
827 checkReturn('testCascade1', typesTask.growableListType); 828 checkReturn('testCascade1', typesTask.growableListType);
828 checkReturn('testCascade2', new TypeMask.nonNullExact( 829 checkReturn('testCascade2', new TypeMask.nonNullExact(
829 findElement(compiler, 'CascadeHelper'))); 830 findElement(compiler, 'CascadeHelper')));
830 checkReturn('testSpecialization1', typesTask.numType); 831 checkReturn('testSpecialization1', typesTask.numType);
831 checkReturn('testSpecialization2', typesTask.dynamicType); 832 checkReturn('testSpecialization2', typesTask.dynamicType);
832 checkReturn('testSpecialization3', typesTask.uint31Type.nullable()); 833 checkReturn('testSpecialization3', typesTask.uint31Type.nullable());
833 checkReturn('testReturnNull1', typesTask.nullType); 834 checkReturn('testReturnNull1', typesTask.nullType);
834 checkReturn('testReturnNull2', typesTask.nullType); 835 checkReturn('testReturnNull2', typesTask.nullType);
835 checkReturn('testReturnNull3', typesTask.dynamicType); 836 checkReturn('testReturnNull3', typesTask.dynamicType);
836 checkReturn('testReturnNull4', typesTask.nullType); 837 checkReturn('testReturnNull4', typesTask.nullType);
837 checkReturn('testReturnNull5', typesTask.nullType); 838 checkReturn('testReturnNull5', typesTask.nullType);
838 checkReturn('testReturnNull6', typesTask.dynamicType); 839 checkReturn('testReturnNull6', typesTask.dynamicType);
839 })); 840 }));
840 } 841 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/field_type_simple_inferer_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698