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

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

Issue 552253002: Adapt TypeMask tests to new TypeMask interface. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 "package:async_helper/async_helper.dart"; 6 import "package:async_helper/async_helper.dart";
7 import 'package:compiler/implementation/types/types.dart' show TypeMask; 7 import 'package:compiler/implementation/types/types.dart' show TypeMask;
8 import 'type_mask_test_helper.dart'; 8 import 'type_mask_test_helper.dart';
9 9
10 import 'compiler_helper.dart'; 10 import 'compiler_helper.dart';
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 testReturnNotEquals(); 702 testReturnNotEquals();
703 } 703 }
704 """; 704 """;
705 705
706 void main() { 706 void main() {
707 Uri uri = new Uri(scheme: 'source'); 707 Uri uri = new Uri(scheme: 'source');
708 var compiler = compilerFor(TEST, uri); 708 var compiler = compilerFor(TEST, uri);
709 asyncTest(() => compiler.runCompiler(uri).then((_) { 709 asyncTest(() => compiler.runCompiler(uri).then((_) {
710 var typesTask = compiler.typesTask; 710 var typesTask = compiler.typesTask;
711 var typesInferrer = typesTask.typesInferrer; 711 var typesInferrer = typesTask.typesInferrer;
712 var world = compiler.world;
712 713
713 checkReturn(String name, type) { 714 checkReturn(String name, type) {
714 var element = findElement(compiler, name); 715 var element = findElement(compiler, name);
715 Expect.equals( 716 Expect.equals(
716 type, 717 type,
717 simplify(typesInferrer.getReturnTypeOfElement(element), compiler), 718 simplify(typesInferrer.getReturnTypeOfElement(element), compiler),
718 name); 719 name);
719 } 720 }
720 var interceptorType = 721 var interceptorType =
721 findTypeMask(compiler, 'Interceptor', 'nonNullSubclass'); 722 findTypeMask(compiler, 'Interceptor', 'nonNullSubclass');
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 checkReturnInClass('B', 'returnInt4', typesTask.positiveIntType); 822 checkReturnInClass('B', 'returnInt4', typesTask.positiveIntType);
822 checkReturnInClass('B', 'returnInt5', typesTask.positiveIntType); 823 checkReturnInClass('B', 'returnInt5', typesTask.positiveIntType);
823 checkReturnInClass('B', 'returnInt6', typesTask.positiveIntType); 824 checkReturnInClass('B', 'returnInt6', typesTask.positiveIntType);
824 checkReturnInClass('B', 'returnInt7', typesTask.positiveIntType); 825 checkReturnInClass('B', 'returnInt7', typesTask.positiveIntType);
825 checkReturnInClass('B', 'returnInt8', typesTask.positiveIntType); 826 checkReturnInClass('B', 'returnInt8', typesTask.positiveIntType);
826 checkReturnInClass('B', 'returnInt9', typesTask.uint31Type); 827 checkReturnInClass('B', 'returnInt9', typesTask.uint31Type);
827 828
828 checkFactoryConstructor(String className, String factoryName) { 829 checkFactoryConstructor(String className, String factoryName) {
829 var cls = findElement(compiler, className); 830 var cls = findElement(compiler, className);
830 var element = cls.localLookup(factoryName); 831 var element = cls.localLookup(factoryName);
831 Expect.equals(new TypeMask.nonNullExact(cls), 832 Expect.equals(new TypeMask.nonNullExact(cls, world),
832 typesInferrer.getReturnTypeOfElement(element)); 833 typesInferrer.getReturnTypeOfElement(element));
833 } 834 }
834 checkFactoryConstructor('A', ''); 835 checkFactoryConstructor('A', '');
835 836
836 checkReturn('testCascade1', typesTask.growableListType); 837 checkReturn('testCascade1', typesTask.growableListType);
837 checkReturn('testCascade2', new TypeMask.nonNullExact( 838 checkReturn('testCascade2', new TypeMask.nonNullExact(
838 findElement(compiler, 'CascadeHelper'))); 839 findElement(compiler, 'CascadeHelper'), world));
839 checkReturn('testSpecialization1', typesTask.numType); 840 checkReturn('testSpecialization1', typesTask.numType);
840 checkReturn('testSpecialization2', typesTask.dynamicType); 841 checkReturn('testSpecialization2', typesTask.dynamicType);
841 checkReturn('testSpecialization3', typesTask.uint31Type.nullable()); 842 checkReturn('testSpecialization3', typesTask.uint31Type.nullable());
842 checkReturn('testReturnNull1', typesTask.nullType); 843 checkReturn('testReturnNull1', typesTask.nullType);
843 checkReturn('testReturnNull2', typesTask.nullType); 844 checkReturn('testReturnNull2', typesTask.nullType);
844 checkReturn('testReturnNull3', typesTask.dynamicType); 845 checkReturn('testReturnNull3', typesTask.dynamicType);
845 checkReturn('testReturnNull4', typesTask.nullType); 846 checkReturn('testReturnNull4', typesTask.nullType);
846 checkReturn('testReturnNull5', typesTask.nullType); 847 checkReturn('testReturnNull5', typesTask.nullType);
847 checkReturn('testReturnNull6', typesTask.dynamicType); 848 checkReturn('testReturnNull6', typesTask.dynamicType);
848 checkReturn('testReturnNotEquals', typesTask.boolType); 849 checkReturn('testReturnNotEquals', typesTask.boolType);
849 })); 850 }));
850 } 851 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698