| OLD | NEW |
| 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 '../../../sdk/lib/_internal/compiler/implementation/types/types.dart' | 6 import '../../../sdk/lib/_internal/compiler/implementation/types/types.dart' |
| 7 show TypeMask; | 7 show TypeMask; |
| 8 | 8 |
| 9 import 'compiler_helper.dart'; | 9 import 'compiler_helper.dart'; |
| 10 | 10 |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 returnDyn4(); | 147 returnDyn4(); |
| 148 returnInt5(); | 148 returnInt5(); |
| 149 returnDyn5(); | 149 returnDyn5(); |
| 150 returnInt6(); | 150 returnInt6(); |
| 151 returnDyn6(); | 151 returnDyn6(); |
| 152 } | 152 } |
| 153 """; | 153 """; |
| 154 | 154 |
| 155 | 155 |
| 156 void main() { | 156 void main() { |
| 157 Uri uri = new Uri.fromComponents(scheme: 'source'); | 157 Uri uri = new Uri(scheme: 'source'); |
| 158 var compiler = compilerFor(TEST, uri); | 158 var compiler = compilerFor(TEST, uri); |
| 159 compiler.runCompiler(uri); | 159 compiler.runCompiler(uri); |
| 160 var typesInferrer = compiler.typesTask.typesInferrer; | 160 var typesInferrer = compiler.typesTask.typesInferrer; |
| 161 | 161 |
| 162 checkReturn(String name, type) { | 162 checkReturn(String name, type) { |
| 163 var element = findElement(compiler, name); | 163 var element = findElement(compiler, name); |
| 164 Expect.equals(type, | 164 Expect.equals(type, |
| 165 typesInferrer.internal.returnTypeOf[element].simplify(compiler)); | 165 typesInferrer.internal.returnTypeOf[element].simplify(compiler)); |
| 166 } | 166 } |
| 167 | 167 |
| 168 checkReturn('returnInt1', typesInferrer.intType); | 168 checkReturn('returnInt1', typesInferrer.intType); |
| 169 checkReturn('returnInt2', typesInferrer.intType); | 169 checkReturn('returnInt2', typesInferrer.intType); |
| 170 checkReturn('returnInt3', typesInferrer.intType); | 170 checkReturn('returnInt3', typesInferrer.intType); |
| 171 checkReturn('returnInt4', typesInferrer.intType); | 171 checkReturn('returnInt4', typesInferrer.intType); |
| 172 checkReturn('returnInt5', typesInferrer.intType); | 172 checkReturn('returnInt5', typesInferrer.intType); |
| 173 checkReturn('returnInt6', | 173 checkReturn('returnInt6', |
| 174 new TypeMask.nonNullSubtype(compiler.intClass.rawType)); | 174 new TypeMask.nonNullSubtype(compiler.intClass.rawType)); |
| 175 | 175 |
| 176 var subclassOfInterceptor = | 176 var subclassOfInterceptor = |
| 177 findTypeMask(compiler, 'Interceptor', 'nonNullSubclass'); | 177 findTypeMask(compiler, 'Interceptor', 'nonNullSubclass'); |
| 178 | 178 |
| 179 checkReturn('returnDyn1', subclassOfInterceptor); | 179 checkReturn('returnDyn1', subclassOfInterceptor); |
| 180 checkReturn('returnDyn2', subclassOfInterceptor); | 180 checkReturn('returnDyn2', subclassOfInterceptor); |
| 181 checkReturn('returnDyn3', subclassOfInterceptor); | 181 checkReturn('returnDyn3', subclassOfInterceptor); |
| 182 checkReturn('returnDyn4', subclassOfInterceptor); | 182 checkReturn('returnDyn4', subclassOfInterceptor); |
| 183 checkReturn('returnDyn5', subclassOfInterceptor); | 183 checkReturn('returnDyn5', subclassOfInterceptor); |
| 184 checkReturn('returnDyn6', typesInferrer.dynamicType); | 184 checkReturn('returnDyn6', typesInferrer.dynamicType); |
| 185 } | 185 } |
| OLD | NEW |