| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library engine.element_test; | 8 library engine.element_test; |
| 9 | 9 |
| 10 import 'package:analyzer/src/generated/ast.dart'; | 10 import 'package:analyzer/src/generated/ast.dart'; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 runReflectiveTests(VoidTypeImplTest); | 33 runReflectiveTests(VoidTypeImplTest); |
| 34 runReflectiveTests(ClassElementImplTest); | 34 runReflectiveTests(ClassElementImplTest); |
| 35 runReflectiveTests(CompilationUnitElementImplTest); | 35 runReflectiveTests(CompilationUnitElementImplTest); |
| 36 runReflectiveTests(ElementLocationImplTest); | 36 runReflectiveTests(ElementLocationImplTest); |
| 37 runReflectiveTests(ElementImplTest); | 37 runReflectiveTests(ElementImplTest); |
| 38 runReflectiveTests(HtmlElementImplTest); | 38 runReflectiveTests(HtmlElementImplTest); |
| 39 runReflectiveTests(LibraryElementImplTest); | 39 runReflectiveTests(LibraryElementImplTest); |
| 40 runReflectiveTests(MultiplyDefinedElementImplTest); | 40 runReflectiveTests(MultiplyDefinedElementImplTest); |
| 41 } | 41 } |
| 42 | 42 |
| 43 @ReflectiveTestCase() |
| 43 class AngularPropertyKindTest extends EngineTestCase { | 44 class AngularPropertyKindTest extends EngineTestCase { |
| 44 void test_ATTR() { | 45 void test_ATTR() { |
| 45 AngularPropertyKind kind = AngularPropertyKind.ATTR; | 46 AngularPropertyKind kind = AngularPropertyKind.ATTR; |
| 46 expect(kind.callsGetter(), isFalse); | 47 expect(kind.callsGetter(), isFalse); |
| 47 expect(kind.callsSetter(), isTrue); | 48 expect(kind.callsSetter(), isTrue); |
| 48 } | 49 } |
| 49 | 50 |
| 50 void test_CALLBACK() { | 51 void test_CALLBACK() { |
| 51 AngularPropertyKind kind = AngularPropertyKind.CALLBACK; | 52 AngularPropertyKind kind = AngularPropertyKind.CALLBACK; |
| 52 expect(kind.callsGetter(), isFalse); | 53 expect(kind.callsGetter(), isFalse); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 65 expect(kind.callsSetter(), isTrue); | 66 expect(kind.callsSetter(), isTrue); |
| 66 } | 67 } |
| 67 | 68 |
| 68 void test_TWO_WAY() { | 69 void test_TWO_WAY() { |
| 69 AngularPropertyKind kind = AngularPropertyKind.TWO_WAY; | 70 AngularPropertyKind kind = AngularPropertyKind.TWO_WAY; |
| 70 expect(kind.callsGetter(), isTrue); | 71 expect(kind.callsGetter(), isTrue); |
| 71 expect(kind.callsSetter(), isTrue); | 72 expect(kind.callsSetter(), isTrue); |
| 72 } | 73 } |
| 73 } | 74 } |
| 74 | 75 |
| 76 @ReflectiveTestCase() |
| 75 class ClassElementImplTest extends EngineTestCase { | 77 class ClassElementImplTest extends EngineTestCase { |
| 76 void test_getAllSupertypes_interface() { | 78 void test_getAllSupertypes_interface() { |
| 77 ClassElement classA = ElementFactory.classElement2("A"); | 79 ClassElement classA = ElementFactory.classElement2("A"); |
| 78 ClassElement classB = ElementFactory.classElement("B", classA.type); | 80 ClassElement classB = ElementFactory.classElement("B", classA.type); |
| 79 ClassElementImpl elementC = ElementFactory.classElement2("C"); | 81 ClassElementImpl elementC = ElementFactory.classElement2("C"); |
| 80 InterfaceType typeObject = classA.supertype; | 82 InterfaceType typeObject = classA.supertype; |
| 81 InterfaceType typeA = classA.type; | 83 InterfaceType typeA = classA.type; |
| 82 InterfaceType typeB = classB.type; | 84 InterfaceType typeB = classB.type; |
| 83 InterfaceType typeC = elementC.type; | 85 InterfaceType typeC = elementC.type; |
| 84 elementC.interfaces = <InterfaceType>[typeB]; | 86 elementC.interfaces = <InterfaceType>[typeB]; |
| (...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 902 ElementFactory.library(createAnalysisContext(), "lib"); | 904 ElementFactory.library(createAnalysisContext(), "lib"); |
| 903 ClassElementImpl classA = ElementFactory.classElement2("A"); | 905 ClassElementImpl classA = ElementFactory.classElement2("A"); |
| 904 ClassElementImpl classB = ElementFactory.classElement("B", classA.type); | 906 ClassElementImpl classB = ElementFactory.classElement("B", classA.type); |
| 905 classA.supertype = classB.type; | 907 classA.supertype = classB.type; |
| 906 (library.definingCompilationUnit as CompilationUnitElementImpl).types = | 908 (library.definingCompilationUnit as CompilationUnitElementImpl).types = |
| 907 <ClassElement>[classA, classB]; | 909 <ClassElement>[classA, classB]; |
| 908 expect(classA.lookUpSetter("s", library), isNull); | 910 expect(classA.lookUpSetter("s", library), isNull); |
| 909 } | 911 } |
| 910 } | 912 } |
| 911 | 913 |
| 914 @ReflectiveTestCase() |
| 912 class CompilationUnitElementImplTest extends EngineTestCase { | 915 class CompilationUnitElementImplTest extends EngineTestCase { |
| 913 void test_getEnum_declared() { | 916 void test_getEnum_declared() { |
| 914 TestTypeProvider typeProvider = new TestTypeProvider(); | 917 TestTypeProvider typeProvider = new TestTypeProvider(); |
| 915 CompilationUnitElementImpl unit = | 918 CompilationUnitElementImpl unit = |
| 916 ElementFactory.compilationUnit("/lib.dart"); | 919 ElementFactory.compilationUnit("/lib.dart"); |
| 917 String enumName = "E"; | 920 String enumName = "E"; |
| 918 ClassElement enumElement = | 921 ClassElement enumElement = |
| 919 ElementFactory.enumElement(typeProvider, enumName); | 922 ElementFactory.enumElement(typeProvider, enumName); |
| 920 unit.enums = <ClassElement>[enumElement]; | 923 unit.enums = <ClassElement>[enumElement]; |
| 921 expect(unit.getEnum(enumName), same(enumElement)); | 924 expect(unit.getEnum(enumName), same(enumElement)); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 944 void test_getType_undeclared() { | 947 void test_getType_undeclared() { |
| 945 CompilationUnitElementImpl unit = | 948 CompilationUnitElementImpl unit = |
| 946 ElementFactory.compilationUnit("/lib.dart"); | 949 ElementFactory.compilationUnit("/lib.dart"); |
| 947 String className = "C"; | 950 String className = "C"; |
| 948 ClassElement classElement = ElementFactory.classElement2(className); | 951 ClassElement classElement = ElementFactory.classElement2(className); |
| 949 unit.types = <ClassElement>[classElement]; | 952 unit.types = <ClassElement>[classElement]; |
| 950 expect(unit.getType("${className}x"), isNull); | 953 expect(unit.getType("${className}x"), isNull); |
| 951 } | 954 } |
| 952 } | 955 } |
| 953 | 956 |
| 957 @ReflectiveTestCase() |
| 954 class ElementImplTest extends EngineTestCase { | 958 class ElementImplTest extends EngineTestCase { |
| 955 void test_equals() { | 959 void test_equals() { |
| 956 LibraryElementImpl library = | 960 LibraryElementImpl library = |
| 957 ElementFactory.library(createAnalysisContext(), "lib"); | 961 ElementFactory.library(createAnalysisContext(), "lib"); |
| 958 ClassElementImpl classElement = ElementFactory.classElement2("C"); | 962 ClassElementImpl classElement = ElementFactory.classElement2("C"); |
| 959 (library.definingCompilationUnit as CompilationUnitElementImpl).types = | 963 (library.definingCompilationUnit as CompilationUnitElementImpl).types = |
| 960 <ClassElement>[classElement]; | 964 <ClassElement>[classElement]; |
| 961 FieldElement field = | 965 FieldElement field = |
| 962 ElementFactory.fieldElement("next", false, false, false, classElement.ty
pe); | 966 ElementFactory.fieldElement("next", false, false, false, classElement.ty
pe); |
| 963 classElement.fields = <FieldElement>[field]; | 967 classElement.fields = <FieldElement>[field]; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1039 ClassElementImpl classElementA = ElementFactory.classElement2("A"); | 1043 ClassElementImpl classElementA = ElementFactory.classElement2("A"); |
| 1040 classElementA.nameOffset = 1; | 1044 classElementA.nameOffset = 1; |
| 1041 ClassElementImpl classElementB = ElementFactory.classElement2("B"); | 1045 ClassElementImpl classElementB = ElementFactory.classElement2("B"); |
| 1042 classElementB.nameOffset = 2; | 1046 classElementB.nameOffset = 2; |
| 1043 expect(Element.SORT_BY_OFFSET(classElementA, classElementA), 0); | 1047 expect(Element.SORT_BY_OFFSET(classElementA, classElementA), 0); |
| 1044 expect(Element.SORT_BY_OFFSET(classElementA, classElementB) < 0, isTrue); | 1048 expect(Element.SORT_BY_OFFSET(classElementA, classElementB) < 0, isTrue); |
| 1045 expect(Element.SORT_BY_OFFSET(classElementB, classElementA) > 0, isTrue); | 1049 expect(Element.SORT_BY_OFFSET(classElementB, classElementA) > 0, isTrue); |
| 1046 } | 1050 } |
| 1047 } | 1051 } |
| 1048 | 1052 |
| 1053 @ReflectiveTestCase() |
| 1049 class ElementKindTest extends EngineTestCase { | 1054 class ElementKindTest extends EngineTestCase { |
| 1050 void test_of_nonNull() { | 1055 void test_of_nonNull() { |
| 1051 expect( | 1056 expect( |
| 1052 ElementKind.of(ElementFactory.classElement2("A")), | 1057 ElementKind.of(ElementFactory.classElement2("A")), |
| 1053 same(ElementKind.CLASS)); | 1058 same(ElementKind.CLASS)); |
| 1054 } | 1059 } |
| 1055 | 1060 |
| 1056 void test_of_null() { | 1061 void test_of_null() { |
| 1057 expect(ElementKind.of(null), same(ElementKind.ERROR)); | 1062 expect(ElementKind.of(null), same(ElementKind.ERROR)); |
| 1058 } | 1063 } |
| 1059 } | 1064 } |
| 1060 | 1065 |
| 1066 @ReflectiveTestCase() |
| 1061 class ElementLocationImplTest extends EngineTestCase { | 1067 class ElementLocationImplTest extends EngineTestCase { |
| 1062 void test_create_encoding() { | 1068 void test_create_encoding() { |
| 1063 String encoding = "a;b;c"; | 1069 String encoding = "a;b;c"; |
| 1064 ElementLocationImpl location = new ElementLocationImpl.con2(encoding); | 1070 ElementLocationImpl location = new ElementLocationImpl.con2(encoding); |
| 1065 expect(location.encoding, encoding); | 1071 expect(location.encoding, encoding); |
| 1066 } | 1072 } |
| 1067 | 1073 |
| 1068 /** | 1074 /** |
| 1069 * For example unnamed constructor. | 1075 * For example unnamed constructor. |
| 1070 */ | 1076 */ |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1115 } | 1121 } |
| 1116 | 1122 |
| 1117 void test_hashCode_equal() { | 1123 void test_hashCode_equal() { |
| 1118 String encoding = "a;b;c"; | 1124 String encoding = "a;b;c"; |
| 1119 ElementLocationImpl first = new ElementLocationImpl.con2(encoding); | 1125 ElementLocationImpl first = new ElementLocationImpl.con2(encoding); |
| 1120 ElementLocationImpl second = new ElementLocationImpl.con2(encoding); | 1126 ElementLocationImpl second = new ElementLocationImpl.con2(encoding); |
| 1121 expect(first.hashCode == second.hashCode, isTrue); | 1127 expect(first.hashCode == second.hashCode, isTrue); |
| 1122 } | 1128 } |
| 1123 } | 1129 } |
| 1124 | 1130 |
| 1131 @ReflectiveTestCase() |
| 1125 class FunctionTypeImplTest extends EngineTestCase { | 1132 class FunctionTypeImplTest extends EngineTestCase { |
| 1126 void test_creation() { | 1133 void test_creation() { |
| 1127 expect( | 1134 expect( |
| 1128 new FunctionTypeImpl.con1( | 1135 new FunctionTypeImpl.con1( |
| 1129 new FunctionElementImpl.forNode(AstFactory.identifier3("f"))), | 1136 new FunctionElementImpl.forNode(AstFactory.identifier3("f"))), |
| 1130 isNotNull); | 1137 isNotNull); |
| 1131 } | 1138 } |
| 1132 | 1139 |
| 1133 void test_getElement() { | 1140 void test_getElement() { |
| 1134 FunctionElementImpl typeElement = | 1141 FunctionElementImpl typeElement = |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1713 expect(normalParameters[0], normalParameterType); | 1720 expect(normalParameters[0], normalParameterType); |
| 1714 List<DartType> optionalParameters = result.optionalParameterTypes; | 1721 List<DartType> optionalParameters = result.optionalParameterTypes; |
| 1715 expect(optionalParameters, hasLength(1)); | 1722 expect(optionalParameters, hasLength(1)); |
| 1716 expect(optionalParameters[0], optionalParameterType); | 1723 expect(optionalParameters[0], optionalParameterType); |
| 1717 Map<String, DartType> namedParameters = result.namedParameterTypes; | 1724 Map<String, DartType> namedParameters = result.namedParameterTypes; |
| 1718 expect(namedParameters, hasLength(1)); | 1725 expect(namedParameters, hasLength(1)); |
| 1719 expect(namedParameters[namedParameterName], namedParameterType); | 1726 expect(namedParameters[namedParameterName], namedParameterType); |
| 1720 } | 1727 } |
| 1721 } | 1728 } |
| 1722 | 1729 |
| 1730 @ReflectiveTestCase() |
| 1723 class HtmlElementImplTest extends EngineTestCase { | 1731 class HtmlElementImplTest extends EngineTestCase { |
| 1724 void test_equals_differentSource() { | 1732 void test_equals_differentSource() { |
| 1725 AnalysisContextImpl context = createAnalysisContext(); | 1733 AnalysisContextImpl context = createAnalysisContext(); |
| 1726 HtmlElementImpl elementA = ElementFactory.htmlUnit(context, "indexA.html"); | 1734 HtmlElementImpl elementA = ElementFactory.htmlUnit(context, "indexA.html"); |
| 1727 HtmlElementImpl elementB = ElementFactory.htmlUnit(context, "indexB.html"); | 1735 HtmlElementImpl elementB = ElementFactory.htmlUnit(context, "indexB.html"); |
| 1728 expect(elementA == elementB, isFalse); | 1736 expect(elementA == elementB, isFalse); |
| 1729 } | 1737 } |
| 1730 | 1738 |
| 1731 void test_equals_null() { | 1739 void test_equals_null() { |
| 1732 AnalysisContextImpl context = createAnalysisContext(); | 1740 AnalysisContextImpl context = createAnalysisContext(); |
| 1733 HtmlElementImpl element = ElementFactory.htmlUnit(context, "index.html"); | 1741 HtmlElementImpl element = ElementFactory.htmlUnit(context, "index.html"); |
| 1734 expect(element == null, isFalse); | 1742 expect(element == null, isFalse); |
| 1735 } | 1743 } |
| 1736 | 1744 |
| 1737 void test_equals_sameSource() { | 1745 void test_equals_sameSource() { |
| 1738 AnalysisContextImpl context = createAnalysisContext(); | 1746 AnalysisContextImpl context = createAnalysisContext(); |
| 1739 HtmlElementImpl elementA = ElementFactory.htmlUnit(context, "index.html"); | 1747 HtmlElementImpl elementA = ElementFactory.htmlUnit(context, "index.html"); |
| 1740 HtmlElementImpl elementB = ElementFactory.htmlUnit(context, "index.html"); | 1748 HtmlElementImpl elementB = ElementFactory.htmlUnit(context, "index.html"); |
| 1741 expect(elementA == elementB, isTrue); | 1749 expect(elementA == elementB, isTrue); |
| 1742 } | 1750 } |
| 1743 | 1751 |
| 1744 void test_equals_self() { | 1752 void test_equals_self() { |
| 1745 AnalysisContextImpl context = createAnalysisContext(); | 1753 AnalysisContextImpl context = createAnalysisContext(); |
| 1746 HtmlElementImpl element = ElementFactory.htmlUnit(context, "index.html"); | 1754 HtmlElementImpl element = ElementFactory.htmlUnit(context, "index.html"); |
| 1747 expect(element == element, isTrue); | 1755 expect(element == element, isTrue); |
| 1748 } | 1756 } |
| 1749 } | 1757 } |
| 1750 | 1758 |
| 1759 @ReflectiveTestCase() |
| 1751 class InterfaceTypeImplTest extends EngineTestCase { | 1760 class InterfaceTypeImplTest extends EngineTestCase { |
| 1752 /** | 1761 /** |
| 1753 * The type provider used to access the types. | 1762 * The type provider used to access the types. |
| 1754 */ | 1763 */ |
| 1755 TestTypeProvider _typeProvider; | 1764 TestTypeProvider _typeProvider; |
| 1756 | 1765 |
| 1757 @override | 1766 @override |
| 1758 void setUp() { | 1767 void setUp() { |
| 1759 _typeProvider = new TestTypeProvider(); | 1768 _typeProvider = new TestTypeProvider(); |
| 1760 } | 1769 } |
| (...skipping 1601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3362 new TypeParameterElementImpl.forNode(AstFactory.identifier3("F"))); | 3371 new TypeParameterElementImpl.forNode(AstFactory.identifier3("F"))); |
| 3363 InterfaceType result = | 3372 InterfaceType result = |
| 3364 type.substitute2(<DartType>[argumentType], <DartType>[parameterType]); | 3373 type.substitute2(<DartType>[argumentType], <DartType>[parameterType]); |
| 3365 expect(result.element, classA); | 3374 expect(result.element, classA); |
| 3366 List<DartType> resultArguments = result.typeArguments; | 3375 List<DartType> resultArguments = result.typeArguments; |
| 3367 expect(resultArguments, hasLength(1)); | 3376 expect(resultArguments, hasLength(1)); |
| 3368 expect(resultArguments[0], parameter); | 3377 expect(resultArguments[0], parameter); |
| 3369 } | 3378 } |
| 3370 } | 3379 } |
| 3371 | 3380 |
| 3381 @ReflectiveTestCase() |
| 3372 class LibraryElementImplTest extends EngineTestCase { | 3382 class LibraryElementImplTest extends EngineTestCase { |
| 3373 void test_creation() { | 3383 void test_creation() { |
| 3374 expect( | 3384 expect( |
| 3375 new LibraryElementImpl.forNode( | 3385 new LibraryElementImpl.forNode( |
| 3376 createAnalysisContext(), | 3386 createAnalysisContext(), |
| 3377 AstFactory.libraryIdentifier2(["l"])), | 3387 AstFactory.libraryIdentifier2(["l"])), |
| 3378 isNotNull); | 3388 isNotNull); |
| 3379 } | 3389 } |
| 3380 | 3390 |
| 3381 void test_getImportedLibraries() { | 3391 void test_getImportedLibraries() { |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3531 ElementFactory.importFor(ElementFactory.library(context, "l3"), null)]; | 3541 ElementFactory.importFor(ElementFactory.library(context, "l3"), null)]; |
| 3532 library.imports = expectedImports; | 3542 library.imports = expectedImports; |
| 3533 List<ImportElement> actualImports = library.imports; | 3543 List<ImportElement> actualImports = library.imports; |
| 3534 expect(actualImports, hasLength(expectedImports.length)); | 3544 expect(actualImports, hasLength(expectedImports.length)); |
| 3535 for (int i = 0; i < actualImports.length; i++) { | 3545 for (int i = 0; i < actualImports.length; i++) { |
| 3536 expect(actualImports[i], same(expectedImports[i])); | 3546 expect(actualImports[i], same(expectedImports[i])); |
| 3537 } | 3547 } |
| 3538 } | 3548 } |
| 3539 } | 3549 } |
| 3540 | 3550 |
| 3551 @ReflectiveTestCase() |
| 3541 class MultiplyDefinedElementImplTest extends EngineTestCase { | 3552 class MultiplyDefinedElementImplTest extends EngineTestCase { |
| 3542 void test_fromElements_conflicting() { | 3553 void test_fromElements_conflicting() { |
| 3543 Element firstElement = ElementFactory.localVariableElement2("xx"); | 3554 Element firstElement = ElementFactory.localVariableElement2("xx"); |
| 3544 Element secondElement = ElementFactory.localVariableElement2("yy"); | 3555 Element secondElement = ElementFactory.localVariableElement2("yy"); |
| 3545 Element result = | 3556 Element result = |
| 3546 MultiplyDefinedElementImpl.fromElements(null, firstElement, secondElemen
t); | 3557 MultiplyDefinedElementImpl.fromElements(null, firstElement, secondElemen
t); |
| 3547 EngineTestCase.assertInstanceOf( | 3558 EngineTestCase.assertInstanceOf( |
| 3548 (obj) => obj is MultiplyDefinedElement, | 3559 (obj) => obj is MultiplyDefinedElement, |
| 3549 MultiplyDefinedElement, | 3560 MultiplyDefinedElement, |
| 3550 result); | 3561 result); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3583 } | 3594 } |
| 3584 | 3595 |
| 3585 void test_fromElements_nonConflicting() { | 3596 void test_fromElements_nonConflicting() { |
| 3586 Element element = ElementFactory.localVariableElement2("xx"); | 3597 Element element = ElementFactory.localVariableElement2("xx"); |
| 3587 expect( | 3598 expect( |
| 3588 MultiplyDefinedElementImpl.fromElements(null, element, element), | 3599 MultiplyDefinedElementImpl.fromElements(null, element, element), |
| 3589 same(element)); | 3600 same(element)); |
| 3590 } | 3601 } |
| 3591 } | 3602 } |
| 3592 | 3603 |
| 3604 @ReflectiveTestCase() |
| 3593 class TypeParameterTypeImplTest extends EngineTestCase { | 3605 class TypeParameterTypeImplTest extends EngineTestCase { |
| 3594 void test_creation() { | 3606 void test_creation() { |
| 3595 expect( | 3607 expect( |
| 3596 new TypeParameterTypeImpl( | 3608 new TypeParameterTypeImpl( |
| 3597 new TypeParameterElementImpl.forNode(AstFactory.identifier3("E"))), | 3609 new TypeParameterElementImpl.forNode(AstFactory.identifier3("E"))), |
| 3598 isNotNull); | 3610 isNotNull); |
| 3599 } | 3611 } |
| 3600 | 3612 |
| 3601 void test_getElement() { | 3613 void test_getElement() { |
| 3602 TypeParameterElementImpl element = | 3614 TypeParameterElementImpl element = |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3711 InterfaceTypeImpl argument = new InterfaceTypeImpl.con1( | 3723 InterfaceTypeImpl argument = new InterfaceTypeImpl.con1( |
| 3712 new ClassElementImpl.forNode(AstFactory.identifier3("A"))); | 3724 new ClassElementImpl.forNode(AstFactory.identifier3("A"))); |
| 3713 TypeParameterTypeImpl parameter = new TypeParameterTypeImpl( | 3725 TypeParameterTypeImpl parameter = new TypeParameterTypeImpl( |
| 3714 new TypeParameterElementImpl.forNode(AstFactory.identifier3("F"))); | 3726 new TypeParameterElementImpl.forNode(AstFactory.identifier3("F"))); |
| 3715 expect( | 3727 expect( |
| 3716 type.substitute2(<DartType>[argument], <DartType>[parameter]), | 3728 type.substitute2(<DartType>[argument], <DartType>[parameter]), |
| 3717 same(type)); | 3729 same(type)); |
| 3718 } | 3730 } |
| 3719 } | 3731 } |
| 3720 | 3732 |
| 3733 @ReflectiveTestCase() |
| 3721 class UnionTypeImplTest extends EngineTestCase { | 3734 class UnionTypeImplTest extends EngineTestCase { |
| 3722 ClassElement _classA; | 3735 ClassElement _classA; |
| 3723 | 3736 |
| 3724 InterfaceType _typeA; | 3737 InterfaceType _typeA; |
| 3725 | 3738 |
| 3726 ClassElement _classB; | 3739 ClassElement _classB; |
| 3727 | 3740 |
| 3728 InterfaceType _typeB; | 3741 InterfaceType _typeB; |
| 3729 | 3742 |
| 3730 DartType _uA; | 3743 DartType _uA; |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3909 // [FunctionTypeImplTest.test_isAssignableTo_normalAndPositionalArgs]. | 3922 // [FunctionTypeImplTest.test_isAssignableTo_normalAndPositionalArgs]. |
| 3910 ClassElement a = ElementFactory.classElement2("A"); | 3923 ClassElement a = ElementFactory.classElement2("A"); |
| 3911 FunctionType t = | 3924 FunctionType t = |
| 3912 ElementFactory.functionElement6("t", null, <ClassElement>[a]).type; | 3925 ElementFactory.functionElement6("t", null, <ClassElement>[a]).type; |
| 3913 DartType uAT = UnionTypeImpl.union([_uA, t]); | 3926 DartType uAT = UnionTypeImpl.union([_uA, t]); |
| 3914 expect(t.isSubtypeOf(uAT), isTrue); | 3927 expect(t.isSubtypeOf(uAT), isTrue); |
| 3915 expect(t.isSubtypeOf(_uAB), isFalse); | 3928 expect(t.isSubtypeOf(_uAB), isFalse); |
| 3916 } | 3929 } |
| 3917 } | 3930 } |
| 3918 | 3931 |
| 3932 @ReflectiveTestCase() |
| 3919 class VoidTypeImplTest extends EngineTestCase { | 3933 class VoidTypeImplTest extends EngineTestCase { |
| 3920 /** | 3934 /** |
| 3921 * Reference {code VoidTypeImpl.getInstance()}. | 3935 * Reference {code VoidTypeImpl.getInstance()}. |
| 3922 */ | 3936 */ |
| 3923 DartType _voidType = VoidTypeImpl.instance; | 3937 DartType _voidType = VoidTypeImpl.instance; |
| 3924 | 3938 |
| 3925 void test_isMoreSpecificThan_void_A() { | 3939 void test_isMoreSpecificThan_void_A() { |
| 3926 ClassElement classA = ElementFactory.classElement2("A"); | 3940 ClassElement classA = ElementFactory.classElement2("A"); |
| 3927 expect(_voidType.isMoreSpecificThan(classA.type), isFalse); | 3941 expect(_voidType.isMoreSpecificThan(classA.type), isFalse); |
| 3928 } | 3942 } |
| (...skipping 26 matching lines...) Expand all Loading... |
| 3955 | 3969 |
| 3956 class _FunctionTypeImplTest_isSubtypeOf_baseCase_classFunction extends | 3970 class _FunctionTypeImplTest_isSubtypeOf_baseCase_classFunction extends |
| 3957 InterfaceTypeImpl { | 3971 InterfaceTypeImpl { |
| 3958 | 3972 |
| 3959 _FunctionTypeImplTest_isSubtypeOf_baseCase_classFunction(ClassElement arg0) | 3973 _FunctionTypeImplTest_isSubtypeOf_baseCase_classFunction(ClassElement arg0) |
| 3960 : super.con1(arg0); | 3974 : super.con1(arg0); |
| 3961 | 3975 |
| 3962 @override | 3976 @override |
| 3963 bool get isDartCoreFunction => true; | 3977 bool get isDartCoreFunction => true; |
| 3964 } | 3978 } |
| OLD | NEW |