| 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 returnInt6(); | 159 returnInt6(); |
| 160 returnDyn6(); | 160 returnDyn6(); |
| 161 returnInt7(); | 161 returnInt7(); |
| 162 } | 162 } |
| 163 """; | 163 """; |
| 164 | 164 |
| 165 | 165 |
| 166 void main() { | 166 void main() { |
| 167 Uri uri = new Uri(scheme: 'source'); | 167 Uri uri = new Uri(scheme: 'source'); |
| 168 var compiler = compilerFor(TEST, uri); | 168 var compiler = compilerFor(TEST, uri); |
| 169 compiler.runCompiler(uri); | 169 compiler.runCompiler(uri).then((_) { |
| 170 var typesTask = compiler.typesTask; | 170 var typesTask = compiler.typesTask; |
| 171 var typesInferrer = typesTask.typesInferrer; | 171 var typesInferrer = typesTask.typesInferrer; |
| 172 | 172 |
| 173 checkReturn(String name, type) { | 173 checkReturn(String name, type) { |
| 174 var element = findElement(compiler, name); | 174 var element = findElement(compiler, name); |
| 175 Expect.equals(type, | 175 Expect.equals(type, |
| 176 typesInferrer.getReturnTypeOfElement(element).simplify(compiler)); | 176 typesInferrer.getReturnTypeOfElement(element).simplify(compiler)); |
| 177 } | 177 } |
| 178 | 178 |
| 179 checkReturn('returnInt1', typesTask.intType); | 179 checkReturn('returnInt1', typesTask.intType); |
| 180 checkReturn('returnInt2', typesTask.intType); | 180 checkReturn('returnInt2', typesTask.intType); |
| 181 checkReturn('returnInt3', typesTask.intType); | 181 checkReturn('returnInt3', typesTask.intType); |
| 182 checkReturn('returnInt4', typesTask.intType); | 182 checkReturn('returnInt4', typesTask.intType); |
| 183 checkReturn('returnInt5', typesTask.intType); | 183 checkReturn('returnInt5', typesTask.intType); |
| 184 checkReturn('returnInt6', | 184 checkReturn('returnInt6', |
| 185 new TypeMask.nonNullSubtype(compiler.intClass.rawType)); | 185 new TypeMask.nonNullSubtype(compiler.intClass.rawType)); |
| 186 checkReturn('returnInt7', typesTask.intType); | |
| 187 | 186 |
| 188 var subclassOfInterceptor = | 187 var subclassOfInterceptor = |
| 189 findTypeMask(compiler, 'Interceptor', 'nonNullSubclass'); | 188 findTypeMask(compiler, 'Interceptor', 'nonNullSubclass'); |
| 190 | 189 |
| 191 checkReturn('returnDyn1', subclassOfInterceptor); | 190 checkReturn('returnDyn1', subclassOfInterceptor); |
| 192 checkReturn('returnDyn2', subclassOfInterceptor); | 191 checkReturn('returnDyn2', subclassOfInterceptor); |
| 193 checkReturn('returnDyn3', subclassOfInterceptor); | 192 checkReturn('returnDyn3', subclassOfInterceptor); |
| 194 checkReturn('returnDyn4', subclassOfInterceptor); | 193 checkReturn('returnDyn4', subclassOfInterceptor); |
| 195 checkReturn('returnDyn5', subclassOfInterceptor); | 194 checkReturn('returnDyn5', subclassOfInterceptor); |
| 196 checkReturn('returnDyn6', typesTask.dynamicType); | 195 checkReturn('returnDyn6', typesTask.dynamicType); |
| 196 }); |
| 197 } | 197 } |
| OLD | NEW |