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 'dart:async'; | 5 import 'dart:async'; |
6 import "package:expect/expect.dart"; | 6 import "package:expect/expect.dart"; |
7 import "package:async_helper/async_helper.dart"; | 7 import "package:async_helper/async_helper.dart"; |
8 import 'package:compiler/src/types/types.dart'; | 8 import 'package:compiler/src/types/types.dart'; |
9 import 'package:compiler/src/inferrer/concrete_types_inferrer.dart'; | 9 import 'package:compiler/src/inferrer/concrete_types_inferrer.dart'; |
10 import 'package:compiler/src/universe/universe.dart' show Selector; | 10 import 'package:compiler/src/universe/universe.dart' show Selector; |
(...skipping 1630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1641 var world = result.compiler.world; | 1641 var world = result.compiler.world; |
1642 | 1642 |
1643 ClassElement a = findElement(result.compiler, 'A'); | 1643 ClassElement a = findElement(result.compiler, 'A'); |
1644 ClassElement b = findElement(result.compiler, 'B'); | 1644 ClassElement b = findElement(result.compiler, 'B'); |
1645 ClassElement c = findElement(result.compiler, 'C'); | 1645 ClassElement c = findElement(result.compiler, 'C'); |
1646 ClassElement xy = findElement(result.compiler, 'XY'); | 1646 ClassElement xy = findElement(result.compiler, 'XY'); |
1647 ClassElement x = findElement(result.compiler, 'X'); | 1647 ClassElement x = findElement(result.compiler, 'X'); |
1648 ClassElement y = findElement(result.compiler, 'Y'); | 1648 ClassElement y = findElement(result.compiler, 'Y'); |
1649 ClassElement z = findElement(result.compiler, 'Z'); | 1649 ClassElement z = findElement(result.compiler, 'Z'); |
1650 | 1650 |
1651 Selector foo = new Selector.call("foo", null, 0); | 1651 Selector foo = new Selector.call(const PublicName("foo"), 0); |
1652 | 1652 |
1653 result.checkSelectorHasType( | 1653 result.checkSelectorHasType( |
1654 foo, | 1654 foo, |
1655 null, | 1655 null, |
1656 new TypeMask.unionOf([a, b, c] | 1656 new TypeMask.unionOf([a, b, c] |
1657 .map((cls) => new TypeMask.nonNullExact(cls, world)), | 1657 .map((cls) => new TypeMask.nonNullExact(cls, world)), |
1658 result.compiler.world)); | 1658 result.compiler.world)); |
1659 result.checkSelectorHasType( | 1659 result.checkSelectorHasType( |
1660 foo, | 1660 foo, |
1661 new TypeMask.subclass(x, world), | 1661 new TypeMask.subclass(x, world), |
1662 new TypeMask.nonNullExact(b, world)); | 1662 new TypeMask.nonNullExact(b, world)); |
1663 result.checkSelectorHasType( | 1663 result.checkSelectorHasType( |
1664 foo, | 1664 foo, |
1665 new TypeMask.subclass(y, world), | 1665 new TypeMask.subclass(y, world), |
1666 new TypeMask.nonNullExact(c, world)); | 1666 new TypeMask.nonNullExact(c, world)); |
1667 result.checkSelectorHasType( | 1667 result.checkSelectorHasType( |
1668 foo, | 1668 foo, |
1669 new TypeMask.subclass(z, world), | 1669 new TypeMask.subclass(z, world), |
1670 new TypeMask.nonNullExact(a, world)); | 1670 new TypeMask.nonNullExact(a, world)); |
1671 result.checkSelectorHasType( | 1671 result.checkSelectorHasType( |
1672 foo, | 1672 foo, |
1673 new TypeMask.subclass(xy, world), | 1673 new TypeMask.subclass(xy, world), |
1674 new TypeMask.unionOf([b, c].map((cls) => | 1674 new TypeMask.unionOf([b, c].map((cls) => |
1675 new TypeMask.nonNullExact(cls, world)), world)); | 1675 new TypeMask.nonNullExact(cls, world)), world)); |
1676 | 1676 |
1677 result.checkSelectorHasType(new Selector.call("bar", null, 0), null, null); | 1677 result.checkSelectorHasType( |
| 1678 new Selector.call(const PublicName("bar"), 0), null, null); |
1678 }); | 1679 }); |
1679 } | 1680 } |
1680 | 1681 |
1681 testEqualsNullSelector() { | 1682 testEqualsNullSelector() { |
1682 final String source = r""" | 1683 final String source = r""" |
1683 main() { | 1684 main() { |
1684 1 == null; | 1685 1 == null; |
1685 } | 1686 } |
1686 """; | 1687 """; |
1687 return analyze(source).then((result) { | 1688 return analyze(source).then((result) { |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2145 testClosures10, | 2146 testClosures10, |
2146 testClosures11, | 2147 testClosures11, |
2147 testClosures12, | 2148 testClosures12, |
2148 testRefinement, | 2149 testRefinement, |
2149 testDefaultArguments, | 2150 testDefaultArguments, |
2150 testSuperConstructorCall, | 2151 testSuperConstructorCall, |
2151 testSuperConstructorCall2, | 2152 testSuperConstructorCall2, |
2152 testSuperConstructorCall3, | 2153 testSuperConstructorCall3, |
2153 ], (f) => f())); | 2154 ], (f) => f())); |
2154 } | 2155 } |
OLD | NEW |