| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/scanner/scannerlib.da
rt'; | 6 import '../../../sdk/lib/_internal/compiler/implementation/scanner/scannerlib.da
rt'; |
| 7 import '../../../sdk/lib/_internal/compiler/implementation/source_file.dart'; | 7 import '../../../sdk/lib/_internal/compiler/implementation/source_file.dart'; |
| 8 import '../../../sdk/lib/_internal/compiler/implementation/types/types.dart'; | 8 import '../../../sdk/lib/_internal/compiler/implementation/types/types.dart'; |
| 9 | 9 |
| 10 import "parser_helper.dart"; | 10 import "parser_helper.dart"; |
| (...skipping 1237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1248 Expect.equals(convert(singleton(cls).union(nullSingleton)), | 1248 Expect.equals(convert(singleton(cls).union(nullSingleton)), |
| 1249 new TypeMask.exact(cls.rawType)); | 1249 new TypeMask.exact(cls.rawType)); |
| 1250 } | 1250 } |
| 1251 | 1251 |
| 1252 Expect.equals(convert(singleton(a).union(singleton(b))), | 1252 Expect.equals(convert(singleton(a).union(singleton(b))), |
| 1253 new TypeMask.nonNullSubclass(a.rawType)); | 1253 new TypeMask.nonNullSubclass(a.rawType)); |
| 1254 | 1254 |
| 1255 Expect.equals(convert(singleton(a).union(singleton(b)).union(nullSingleton)), | 1255 Expect.equals(convert(singleton(a).union(singleton(b)).union(nullSingleton)), |
| 1256 new TypeMask.subclass(a.rawType)); | 1256 new TypeMask.subclass(a.rawType)); |
| 1257 | 1257 |
| 1258 Expect.equals(convert(singleton(b).union(singleton(d))), | 1258 Expect.equals( |
| 1259 new TypeMask.nonNullSubtype(a.rawType)); | 1259 convert(singleton(b).union(singleton(d))).simplify(result.compiler), |
| 1260 new TypeMask.nonNullSubtype(a.rawType)); |
| 1260 } | 1261 } |
| 1261 | 1262 |
| 1262 testSelectors() { | 1263 testSelectors() { |
| 1263 final String source = r""" | 1264 final String source = r""" |
| 1264 // ABC <--- A | 1265 // ABC <--- A |
| 1265 // `- BC <--- B | 1266 // `- BC <--- B |
| 1266 // `- C | 1267 // `- C |
| 1267 | 1268 |
| 1268 class ABC {} | 1269 class ABC {} |
| 1269 class A extends ABC {} | 1270 class A extends ABC {} |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1295 ClassElement b = findElement(result.compiler, 'B'); | 1296 ClassElement b = findElement(result.compiler, 'B'); |
| 1296 ClassElement c = findElement(result.compiler, 'C'); | 1297 ClassElement c = findElement(result.compiler, 'C'); |
| 1297 ClassElement xy = findElement(result.compiler, 'XY'); | 1298 ClassElement xy = findElement(result.compiler, 'XY'); |
| 1298 ClassElement x = findElement(result.compiler, 'X'); | 1299 ClassElement x = findElement(result.compiler, 'X'); |
| 1299 ClassElement y = findElement(result.compiler, 'Y'); | 1300 ClassElement y = findElement(result.compiler, 'Y'); |
| 1300 ClassElement z = findElement(result.compiler, 'Z'); | 1301 ClassElement z = findElement(result.compiler, 'Z'); |
| 1301 | 1302 |
| 1302 Selector foo = new Selector.call(buildSourceString("foo"), null, 0); | 1303 Selector foo = new Selector.call(buildSourceString("foo"), null, 0); |
| 1303 | 1304 |
| 1304 Expect.equals( | 1305 Expect.equals( |
| 1305 inferredType(foo), | 1306 inferredType(foo).simplify(result.compiler), |
| 1306 new TypeMask.nonNullSubclass(abc.rawType)); | 1307 new TypeMask.nonNullSubclass(abc.rawType)); |
| 1307 Expect.equals( | 1308 Expect.equals( |
| 1308 inferredType(new TypedSelector.subclass(x.rawType, foo)), | 1309 inferredType(new TypedSelector.subclass(x.rawType, foo)), |
| 1309 new TypeMask.nonNullExact(b.rawType)); | 1310 new TypeMask.nonNullExact(b.rawType)); |
| 1310 Expect.equals( | 1311 Expect.equals( |
| 1311 inferredType(new TypedSelector.subclass(y.rawType, foo)), | 1312 inferredType(new TypedSelector.subclass(y.rawType, foo)), |
| 1312 new TypeMask.nonNullExact(c.rawType)); | 1313 new TypeMask.nonNullExact(c.rawType)); |
| 1313 Expect.equals( | 1314 Expect.equals( |
| 1314 inferredType(new TypedSelector.subclass(z.rawType, foo)), | 1315 inferredType(new TypedSelector.subclass(z.rawType, foo)), |
| 1315 new TypeMask.nonNullExact(a.rawType)); | 1316 new TypeMask.nonNullExact(a.rawType)); |
| 1316 Expect.equals( | 1317 Expect.equals( |
| 1317 inferredType(new TypedSelector.subclass(xy.rawType, foo)), | 1318 inferredType(new TypedSelector.subclass( |
| 1319 xy.rawType, foo)).simplify(result.compiler), |
| 1318 new TypeMask.nonNullSubclass(bc.rawType)); | 1320 new TypeMask.nonNullSubclass(bc.rawType)); |
| 1319 | 1321 |
| 1320 Selector bar = new Selector.call(buildSourceString("bar"), null, 0); | 1322 Selector bar = new Selector.call(buildSourceString("bar"), null, 0); |
| 1321 | 1323 |
| 1322 Expect.isNull(inferredType(bar)); | 1324 Expect.isNull(inferredType(bar)); |
| 1323 } | 1325 } |
| 1324 | 1326 |
| 1325 void main() { | 1327 void main() { |
| 1326 testDynamicBackDoor(); | 1328 testDynamicBackDoor(); |
| 1327 testLiterals(); | 1329 testLiterals(); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1366 testListWithCapacity(); | 1368 testListWithCapacity(); |
| 1367 testEmptyList(); | 1369 testEmptyList(); |
| 1368 testJsCall(); | 1370 testJsCall(); |
| 1369 testIsCheck(); | 1371 testIsCheck(); |
| 1370 testSeenClasses(); | 1372 testSeenClasses(); |
| 1371 testGoodGuys(); | 1373 testGoodGuys(); |
| 1372 testIntDoubleNum(); | 1374 testIntDoubleNum(); |
| 1373 testConcreteTypeToTypeMask(); | 1375 testConcreteTypeToTypeMask(); |
| 1374 testSelectors(); | 1376 testSelectors(); |
| 1375 } | 1377 } |
| OLD | NEW |