Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(125)

Side by Side Diff: pkg/analyzer/test/generated/resolver_test.dart

Issue 1513643009: Clean up package imports and library names (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 library engine.resolver_test; 5 library analyzer.test.generated.resolver_test;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/src/context/context.dart'; 9 import 'package:analyzer/src/context/context.dart';
10 import 'package:analyzer/src/generated/ast.dart'; 10 import 'package:analyzer/src/generated/ast.dart';
11 import 'package:analyzer/src/generated/element.dart'; 11 import 'package:analyzer/src/generated/element.dart';
12 import 'package:analyzer/src/generated/element_resolver.dart'; 12 import 'package:analyzer/src/generated/element_resolver.dart';
13 import 'package:analyzer/src/generated/engine.dart'; 13 import 'package:analyzer/src/generated/engine.dart';
14 import 'package:analyzer/src/generated/error.dart'; 14 import 'package:analyzer/src/generated/error.dart';
15 import 'package:analyzer/src/generated/java_core.dart'; 15 import 'package:analyzer/src/generated/java_core.dart';
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 futureElement.constructors = <ConstructorElement>[futureConstructor]; 186 futureElement.constructors = <ConstructorElement>[futureConstructor];
187 // Future then(onValue(T value), { Function onError }); 187 // Future then(onValue(T value), { Function onError });
188 TypeDefiningElement futureThenR = DynamicElementImpl.instance; 188 TypeDefiningElement futureThenR = DynamicElementImpl.instance;
189 if (context.analysisOptions.strongMode) { 189 if (context.analysisOptions.strongMode) {
190 futureThenR = ElementFactory.typeParameterWithType('R'); 190 futureThenR = ElementFactory.typeParameterWithType('R');
191 } 191 }
192 FunctionElementImpl thenOnValue = ElementFactory.functionElement3( 192 FunctionElementImpl thenOnValue = ElementFactory.functionElement3(
193 'onValue', futureThenR, [futureElement.typeParameters[0]], null); 193 'onValue', futureThenR, [futureElement.typeParameters[0]], null);
194 194
195 DartType futureRType = futureElement.type.substitute4([futureThenR.type]); 195 DartType futureRType = futureElement.type.substitute4([futureThenR.type]);
196 MethodElementImpl thenMethod = ElementFactory.methodElementWithParameters( 196 MethodElementImpl thenMethod = ElementFactory
197 futureElement, "then", futureRType, [ 197 .methodElementWithParameters(futureElement, "then", futureRType, [
198 ElementFactory.requiredParameter2("onValue", thenOnValue.type), 198 ElementFactory.requiredParameter2("onValue", thenOnValue.type),
199 ElementFactory.namedParameter2("onError", provider.functionType) 199 ElementFactory.namedParameter2("onError", provider.functionType)
200 ]); 200 ]);
201 if (!futureThenR.type.isDynamic) { 201 if (!futureThenR.type.isDynamic) {
202 thenMethod.typeParameters = [futureThenR]; 202 thenMethod.typeParameters = [futureThenR];
203 } 203 }
204 thenOnValue.enclosingElement = thenMethod; 204 thenOnValue.enclosingElement = thenMethod;
205 thenOnValue.type = new FunctionTypeImpl(thenOnValue); 205 thenOnValue.type = new FunctionTypeImpl(thenOnValue);
206 (thenMethod.parameters[0] as ParameterElementImpl).type = thenOnValue.type; 206 (thenMethod.parameters[0] as ParameterElementImpl).type = thenOnValue.type;
207 thenMethod.type = new FunctionTypeImpl(thenMethod); 207 thenMethod.type = new FunctionTypeImpl(thenMethod);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 ElementFactory.getterElement("context2D", false, context2dElement.type) 275 ElementFactory.getterElement("context2D", false, context2dElement.type)
276 ]; 276 ];
277 canvasElement.fields = canvasElement.accessors 277 canvasElement.fields = canvasElement.accessors
278 .map((PropertyAccessorElement accessor) => accessor.variable) 278 .map((PropertyAccessorElement accessor) => accessor.variable)
279 .toList(); 279 .toList();
280 ClassElementImpl documentElement = 280 ClassElementImpl documentElement =
281 ElementFactory.classElement("Document", elementType); 281 ElementFactory.classElement("Document", elementType);
282 ClassElementImpl htmlDocumentElement = 282 ClassElementImpl htmlDocumentElement =
283 ElementFactory.classElement("HtmlDocument", documentElement.type); 283 ElementFactory.classElement("HtmlDocument", documentElement.type);
284 htmlDocumentElement.methods = <MethodElement>[ 284 htmlDocumentElement.methods = <MethodElement>[
285 ElementFactory.methodElement( 285 ElementFactory
286 "query", elementType, <DartType>[provider.stringType]) 286 .methodElement("query", elementType, <DartType>[provider.stringType])
287 ]; 287 ];
288 htmlUnit.types = <ClassElement>[ 288 htmlUnit.types = <ClassElement>[
289 ElementFactory.classElement("AnchorElement", elementType), 289 ElementFactory.classElement("AnchorElement", elementType),
290 ElementFactory.classElement("BodyElement", elementType), 290 ElementFactory.classElement("BodyElement", elementType),
291 ElementFactory.classElement("ButtonElement", elementType), 291 ElementFactory.classElement("ButtonElement", elementType),
292 canvasElement, 292 canvasElement,
293 contextElement, 293 contextElement,
294 context2dElement, 294 context2dElement,
295 ElementFactory.classElement("DivElement", elementType), 295 ElementFactory.classElement("DivElement", elementType),
296 documentElement, 296 documentElement,
297 elementElement, 297 elementElement,
298 htmlDocumentElement, 298 htmlDocumentElement,
299 ElementFactory.classElement("InputElement", elementType), 299 ElementFactory.classElement("InputElement", elementType),
300 ElementFactory.classElement("SelectElement", elementType) 300 ElementFactory.classElement("SelectElement", elementType)
301 ]; 301 ];
302 htmlUnit.functions = <FunctionElement>[ 302 htmlUnit.functions = <FunctionElement>[
303 ElementFactory.functionElement3("query", elementElement, 303 ElementFactory.functionElement3("query", elementElement,
304 <ClassElement>[provider.stringType.element], ClassElement.EMPTY_LIST) 304 <ClassElement>[provider.stringType.element], ClassElement.EMPTY_LIST)
305 ]; 305 ];
306 TopLevelVariableElementImpl document = ElementFactory 306 TopLevelVariableElementImpl document =
307 .topLevelVariableElement3( 307 ElementFactory.topLevelVariableElement3(
308 "document", false, true, htmlDocumentElement.type); 308 "document", false, true, htmlDocumentElement.type);
309 htmlUnit.topLevelVariables = <TopLevelVariableElement>[document]; 309 htmlUnit.topLevelVariables = <TopLevelVariableElement>[document];
310 htmlUnit.accessors = <PropertyAccessorElement>[document.getter]; 310 htmlUnit.accessors = <PropertyAccessorElement>[document.getter];
311 LibraryElementImpl htmlLibrary = new LibraryElementImpl.forNode( 311 LibraryElementImpl htmlLibrary = new LibraryElementImpl.forNode(
312 coreContext, AstFactory.libraryIdentifier2(["dart", "dom", "html"])); 312 coreContext, AstFactory.libraryIdentifier2(["dart", "dom", "html"]));
313 htmlLibrary.definingCompilationUnit = htmlUnit; 313 htmlLibrary.definingCompilationUnit = htmlUnit;
314 // 314 //
315 // dart:math 315 // dart:math
316 // 316 //
317 CompilationUnitElementImpl mathUnit = 317 CompilationUnitElementImpl mathUnit =
(...skipping 4762 matching lines...) Expand 10 before | Expand all | Expand 10 after
5080 5080
5081 void test_getMapOfMembersInheritedFromInterfaces_implicitExtends() { 5081 void test_getMapOfMembersInheritedFromInterfaces_implicitExtends() {
5082 // class A {} 5082 // class A {}
5083 ClassElementImpl classA = ElementFactory.classElement2("A"); 5083 ClassElementImpl classA = ElementFactory.classElement2("A");
5084 MemberMap mapA = 5084 MemberMap mapA =
5085 _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classA); 5085 _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classA);
5086 expect(mapA.size, _numOfMembersInObject); 5086 expect(mapA.size, _numOfMembersInObject);
5087 _assertNoErrors(classA); 5087 _assertNoErrors(classA);
5088 } 5088 }
5089 5089
5090 void test_getMapOfMembersInheritedFromInterfaces_inconsistentMethodInheritance _getter_method() { 5090 void
5091 test_getMapOfMembersInheritedFromInterfaces_inconsistentMethodInheritance_ getter_method() {
5091 // class I1 { int m(); } 5092 // class I1 { int m(); }
5092 // class I2 { int get m; } 5093 // class I2 { int get m; }
5093 // class A implements I2, I1 {} 5094 // class A implements I2, I1 {}
5094 ClassElementImpl classI1 = ElementFactory.classElement2("I1"); 5095 ClassElementImpl classI1 = ElementFactory.classElement2("I1");
5095 String methodName = "m"; 5096 String methodName = "m";
5096 MethodElement methodM = 5097 MethodElement methodM =
5097 ElementFactory.methodElement(methodName, _typeProvider.intType); 5098 ElementFactory.methodElement(methodName, _typeProvider.intType);
5098 classI1.methods = <MethodElement>[methodM]; 5099 classI1.methods = <MethodElement>[methodM];
5099 ClassElementImpl classI2 = ElementFactory.classElement2("I2"); 5100 ClassElementImpl classI2 = ElementFactory.classElement2("I2");
5100 PropertyAccessorElement getter = 5101 PropertyAccessorElement getter =
5101 ElementFactory.getterElement(methodName, false, _typeProvider.intType); 5102 ElementFactory.getterElement(methodName, false, _typeProvider.intType);
5102 classI2.accessors = <PropertyAccessorElement>[getter]; 5103 classI2.accessors = <PropertyAccessorElement>[getter];
5103 ClassElementImpl classA = ElementFactory.classElement2("A"); 5104 ClassElementImpl classA = ElementFactory.classElement2("A");
5104 classA.interfaces = <InterfaceType>[classI2.type, classI1.type]; 5105 classA.interfaces = <InterfaceType>[classI2.type, classI1.type];
5105 MemberMap mapA = 5106 MemberMap mapA =
5106 _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classA); 5107 _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classA);
5107 expect(mapA.size, _numOfMembersInObject); 5108 expect(mapA.size, _numOfMembersInObject);
5108 expect(mapA.get(methodName), isNull); 5109 expect(mapA.get(methodName), isNull);
5109 _assertErrors(classA, 5110 _assertErrors(classA,
5110 [StaticWarningCode.INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_METHOD]); 5111 [StaticWarningCode.INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_METHOD]);
5111 } 5112 }
5112 5113
5113 void test_getMapOfMembersInheritedFromInterfaces_inconsistentMethodInheritance _int_str() { 5114 void
5115 test_getMapOfMembersInheritedFromInterfaces_inconsistentMethodInheritance_ int_str() {
5114 // class I1 { int m(); } 5116 // class I1 { int m(); }
5115 // class I2 { String m(); } 5117 // class I2 { String m(); }
5116 // class A implements I1, I2 {} 5118 // class A implements I1, I2 {}
5117 ClassElementImpl classI1 = ElementFactory.classElement2("I1"); 5119 ClassElementImpl classI1 = ElementFactory.classElement2("I1");
5118 String methodName = "m"; 5120 String methodName = "m";
5119 MethodElement methodM1 = 5121 MethodElement methodM1 =
5120 ElementFactory.methodElement(methodName, null, [_typeProvider.intType]); 5122 ElementFactory.methodElement(methodName, null, [_typeProvider.intType]);
5121 classI1.methods = <MethodElement>[methodM1]; 5123 classI1.methods = <MethodElement>[methodM1];
5122 ClassElementImpl classI2 = ElementFactory.classElement2("I2"); 5124 ClassElementImpl classI2 = ElementFactory.classElement2("I2");
5123 MethodElement methodM2 = ElementFactory.methodElement( 5125 MethodElement methodM2 = ElementFactory
5124 methodName, null, [_typeProvider.stringType]); 5126 .methodElement(methodName, null, [_typeProvider.stringType]);
5125 classI2.methods = <MethodElement>[methodM2]; 5127 classI2.methods = <MethodElement>[methodM2];
5126 ClassElementImpl classA = ElementFactory.classElement2("A"); 5128 ClassElementImpl classA = ElementFactory.classElement2("A");
5127 classA.interfaces = <InterfaceType>[classI1.type, classI2.type]; 5129 classA.interfaces = <InterfaceType>[classI1.type, classI2.type];
5128 MemberMap mapA = 5130 MemberMap mapA =
5129 _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classA); 5131 _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classA);
5130 expect(mapA.size, _numOfMembersInObject); 5132 expect(mapA.size, _numOfMembersInObject);
5131 expect(mapA.get(methodName), isNull); 5133 expect(mapA.get(methodName), isNull);
5132 _assertErrors( 5134 _assertErrors(
5133 classA, [StaticTypeWarningCode.INCONSISTENT_METHOD_INHERITANCE]); 5135 classA, [StaticTypeWarningCode.INCONSISTENT_METHOD_INHERITANCE]);
5134 } 5136 }
5135 5137
5136 void test_getMapOfMembersInheritedFromInterfaces_inconsistentMethodInheritance _method_getter() { 5138 void
5139 test_getMapOfMembersInheritedFromInterfaces_inconsistentMethodInheritance_ method_getter() {
5137 // class I1 { int m(); } 5140 // class I1 { int m(); }
5138 // class I2 { int get m; } 5141 // class I2 { int get m; }
5139 // class A implements I1, I2 {} 5142 // class A implements I1, I2 {}
5140 ClassElementImpl classI1 = ElementFactory.classElement2("I1"); 5143 ClassElementImpl classI1 = ElementFactory.classElement2("I1");
5141 String methodName = "m"; 5144 String methodName = "m";
5142 MethodElement methodM = 5145 MethodElement methodM =
5143 ElementFactory.methodElement(methodName, _typeProvider.intType); 5146 ElementFactory.methodElement(methodName, _typeProvider.intType);
5144 classI1.methods = <MethodElement>[methodM]; 5147 classI1.methods = <MethodElement>[methodM];
5145 ClassElementImpl classI2 = ElementFactory.classElement2("I2"); 5148 ClassElementImpl classI2 = ElementFactory.classElement2("I2");
5146 PropertyAccessorElement getter = 5149 PropertyAccessorElement getter =
5147 ElementFactory.getterElement(methodName, false, _typeProvider.intType); 5150 ElementFactory.getterElement(methodName, false, _typeProvider.intType);
5148 classI2.accessors = <PropertyAccessorElement>[getter]; 5151 classI2.accessors = <PropertyAccessorElement>[getter];
5149 ClassElementImpl classA = ElementFactory.classElement2("A"); 5152 ClassElementImpl classA = ElementFactory.classElement2("A");
5150 classA.interfaces = <InterfaceType>[classI1.type, classI2.type]; 5153 classA.interfaces = <InterfaceType>[classI1.type, classI2.type];
5151 MemberMap mapA = 5154 MemberMap mapA =
5152 _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classA); 5155 _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classA);
5153 expect(mapA.size, _numOfMembersInObject); 5156 expect(mapA.size, _numOfMembersInObject);
5154 expect(mapA.get(methodName), isNull); 5157 expect(mapA.get(methodName), isNull);
5155 _assertErrors(classA, 5158 _assertErrors(classA,
5156 [StaticWarningCode.INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_METHOD]); 5159 [StaticWarningCode.INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_METHOD]);
5157 } 5160 }
5158 5161
5159 void test_getMapOfMembersInheritedFromInterfaces_inconsistentMethodInheritance _numOfRequiredParams() { 5162 void
5163 test_getMapOfMembersInheritedFromInterfaces_inconsistentMethodInheritance_ numOfRequiredParams() {
5160 // class I1 { dynamic m(int, [int]); } 5164 // class I1 { dynamic m(int, [int]); }
5161 // class I2 { dynamic m(int, int, int); } 5165 // class I2 { dynamic m(int, int, int); }
5162 // class A implements I1, I2 {} 5166 // class A implements I1, I2 {}
5163 ClassElementImpl classI1 = ElementFactory.classElement2("I1"); 5167 ClassElementImpl classI1 = ElementFactory.classElement2("I1");
5164 String methodName = "m"; 5168 String methodName = "m";
5165 MethodElementImpl methodM1 = 5169 MethodElementImpl methodM1 =
5166 ElementFactory.methodElement(methodName, _typeProvider.dynamicType); 5170 ElementFactory.methodElement(methodName, _typeProvider.dynamicType);
5167 ParameterElementImpl parameter1 = 5171 ParameterElementImpl parameter1 =
5168 new ParameterElementImpl.forNode(AstFactory.identifier3("a1")); 5172 new ParameterElementImpl.forNode(AstFactory.identifier3("a1"));
5169 parameter1.type = _typeProvider.intType; 5173 parameter1.type = _typeProvider.intType;
(...skipping 28 matching lines...) Expand all
5198 ClassElementImpl classA = ElementFactory.classElement2("A"); 5202 ClassElementImpl classA = ElementFactory.classElement2("A");
5199 classA.interfaces = <InterfaceType>[classI1.type, classI2.type]; 5203 classA.interfaces = <InterfaceType>[classI1.type, classI2.type];
5200 MemberMap mapA = 5204 MemberMap mapA =
5201 _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classA); 5205 _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classA);
5202 expect(mapA.size, _numOfMembersInObject); 5206 expect(mapA.size, _numOfMembersInObject);
5203 expect(mapA.get(methodName), isNull); 5207 expect(mapA.get(methodName), isNull);
5204 _assertErrors( 5208 _assertErrors(
5205 classA, [StaticTypeWarningCode.INCONSISTENT_METHOD_INHERITANCE]); 5209 classA, [StaticTypeWarningCode.INCONSISTENT_METHOD_INHERITANCE]);
5206 } 5210 }
5207 5211
5208 void test_getMapOfMembersInheritedFromInterfaces_inconsistentMethodInheritance _str_int() { 5212 void
5213 test_getMapOfMembersInheritedFromInterfaces_inconsistentMethodInheritance_ str_int() {
5209 // class I1 { int m(); } 5214 // class I1 { int m(); }
5210 // class I2 { String m(); } 5215 // class I2 { String m(); }
5211 // class A implements I2, I1 {} 5216 // class A implements I2, I1 {}
5212 ClassElementImpl classI1 = ElementFactory.classElement2("I1"); 5217 ClassElementImpl classI1 = ElementFactory.classElement2("I1");
5213 String methodName = "m"; 5218 String methodName = "m";
5214 MethodElement methodM1 = ElementFactory.methodElement( 5219 MethodElement methodM1 = ElementFactory
5215 methodName, null, [_typeProvider.stringType]); 5220 .methodElement(methodName, null, [_typeProvider.stringType]);
5216 classI1.methods = <MethodElement>[methodM1]; 5221 classI1.methods = <MethodElement>[methodM1];
5217 ClassElementImpl classI2 = ElementFactory.classElement2("I2"); 5222 ClassElementImpl classI2 = ElementFactory.classElement2("I2");
5218 MethodElement methodM2 = 5223 MethodElement methodM2 =
5219 ElementFactory.methodElement(methodName, null, [_typeProvider.intType]); 5224 ElementFactory.methodElement(methodName, null, [_typeProvider.intType]);
5220 classI2.methods = <MethodElement>[methodM2]; 5225 classI2.methods = <MethodElement>[methodM2];
5221 ClassElementImpl classA = ElementFactory.classElement2("A"); 5226 ClassElementImpl classA = ElementFactory.classElement2("A");
5222 classA.interfaces = <InterfaceType>[classI2.type, classI1.type]; 5227 classA.interfaces = <InterfaceType>[classI2.type, classI1.type];
5223 MemberMap mapA = 5228 MemberMap mapA =
5224 _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classA); 5229 _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classA);
5225 expect(mapA.size, _numOfMembersInObject); 5230 expect(mapA.size, _numOfMembersInObject);
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
5307 ClassElementImpl classA = ElementFactory.classElement2("A"); 5312 ClassElementImpl classA = ElementFactory.classElement2("A");
5308 classA.interfaces = <InterfaceType>[classI1.type, classI2.type]; 5313 classA.interfaces = <InterfaceType>[classI1.type, classI2.type];
5309 MemberMap mapA = 5314 MemberMap mapA =
5310 _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classA); 5315 _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classA);
5311 expect(mapA.size, _numOfMembersInObject + 2); 5316 expect(mapA.size, _numOfMembersInObject + 2);
5312 expect(mapA.get(methodName1), same(methodM1)); 5317 expect(mapA.get(methodName1), same(methodM1));
5313 expect(mapA.get(methodName2), same(methodM2)); 5318 expect(mapA.get(methodName2), same(methodM2));
5314 _assertNoErrors(classA); 5319 _assertNoErrors(classA);
5315 } 5320 }
5316 5321
5317 void test_getMapOfMembersInheritedFromInterfaces_union_multipleSubtypes_2_gett ers() { 5322 void
5323 test_getMapOfMembersInheritedFromInterfaces_union_multipleSubtypes_2_gette rs() {
5318 // class I1 { int get g; } 5324 // class I1 { int get g; }
5319 // class I2 { num get g; } 5325 // class I2 { num get g; }
5320 // class A implements I1, I2 {} 5326 // class A implements I1, I2 {}
5321 ClassElementImpl classI1 = ElementFactory.classElement2("I1"); 5327 ClassElementImpl classI1 = ElementFactory.classElement2("I1");
5322 String accessorName = "g"; 5328 String accessorName = "g";
5323 PropertyAccessorElement getter1 = ElementFactory.getterElement( 5329 PropertyAccessorElement getter1 = ElementFactory.getterElement(
5324 accessorName, false, _typeProvider.intType); 5330 accessorName, false, _typeProvider.intType);
5325 classI1.accessors = <PropertyAccessorElement>[getter1]; 5331 classI1.accessors = <PropertyAccessorElement>[getter1];
5326 ClassElementImpl classI2 = ElementFactory.classElement2("I2"); 5332 ClassElementImpl classI2 = ElementFactory.classElement2("I2");
5327 PropertyAccessorElement getter2 = ElementFactory.getterElement( 5333 PropertyAccessorElement getter2 = ElementFactory.getterElement(
5328 accessorName, false, _typeProvider.numType); 5334 accessorName, false, _typeProvider.numType);
5329 classI2.accessors = <PropertyAccessorElement>[getter2]; 5335 classI2.accessors = <PropertyAccessorElement>[getter2];
5330 ClassElementImpl classA = ElementFactory.classElement2("A"); 5336 ClassElementImpl classA = ElementFactory.classElement2("A");
5331 classA.interfaces = <InterfaceType>[classI1.type, classI2.type]; 5337 classA.interfaces = <InterfaceType>[classI1.type, classI2.type];
5332 MemberMap mapA = 5338 MemberMap mapA =
5333 _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classA); 5339 _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classA);
5334 expect(mapA.size, _numOfMembersInObject + 1); 5340 expect(mapA.size, _numOfMembersInObject + 1);
5335 PropertyAccessorElement syntheticAccessor = ElementFactory.getterElement( 5341 PropertyAccessorElement syntheticAccessor = ElementFactory.getterElement(
5336 accessorName, false, _typeProvider.dynamicType); 5342 accessorName, false, _typeProvider.dynamicType);
5337 expect(mapA.get(accessorName).type, syntheticAccessor.type); 5343 expect(mapA.get(accessorName).type, syntheticAccessor.type);
5338 _assertNoErrors(classA); 5344 _assertNoErrors(classA);
5339 } 5345 }
5340 5346
5341 void test_getMapOfMembersInheritedFromInterfaces_union_multipleSubtypes_2_meth ods() { 5347 void
5348 test_getMapOfMembersInheritedFromInterfaces_union_multipleSubtypes_2_metho ds() {
5342 // class I1 { dynamic m(int); } 5349 // class I1 { dynamic m(int); }
5343 // class I2 { dynamic m(num); } 5350 // class I2 { dynamic m(num); }
5344 // class A implements I1, I2 {} 5351 // class A implements I1, I2 {}
5345 ClassElementImpl classI1 = ElementFactory.classElement2("I1"); 5352 ClassElementImpl classI1 = ElementFactory.classElement2("I1");
5346 String methodName = "m"; 5353 String methodName = "m";
5347 MethodElementImpl methodM1 = 5354 MethodElementImpl methodM1 =
5348 ElementFactory.methodElement(methodName, _typeProvider.dynamicType); 5355 ElementFactory.methodElement(methodName, _typeProvider.dynamicType);
5349 ParameterElementImpl parameter1 = 5356 ParameterElementImpl parameter1 =
5350 new ParameterElementImpl.forNode(AstFactory.identifier3("a0")); 5357 new ParameterElementImpl.forNode(AstFactory.identifier3("a0"));
5351 parameter1.type = _typeProvider.intType; 5358 parameter1.type = _typeProvider.intType;
(...skipping 13 matching lines...) Expand all
5365 classA.interfaces = <InterfaceType>[classI1.type, classI2.type]; 5372 classA.interfaces = <InterfaceType>[classI1.type, classI2.type];
5366 MemberMap mapA = 5373 MemberMap mapA =
5367 _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classA); 5374 _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classA);
5368 expect(mapA.size, _numOfMembersInObject + 1); 5375 expect(mapA.size, _numOfMembersInObject + 1);
5369 MethodElement syntheticMethod = ElementFactory.methodElement( 5376 MethodElement syntheticMethod = ElementFactory.methodElement(
5370 methodName, _typeProvider.dynamicType, [_typeProvider.dynamicType]); 5377 methodName, _typeProvider.dynamicType, [_typeProvider.dynamicType]);
5371 expect(mapA.get(methodName).type, syntheticMethod.type); 5378 expect(mapA.get(methodName).type, syntheticMethod.type);
5372 _assertNoErrors(classA); 5379 _assertNoErrors(classA);
5373 } 5380 }
5374 5381
5375 void test_getMapOfMembersInheritedFromInterfaces_union_multipleSubtypes_2_sett ers() { 5382 void
5383 test_getMapOfMembersInheritedFromInterfaces_union_multipleSubtypes_2_sette rs() {
5376 // class I1 { set s(int); } 5384 // class I1 { set s(int); }
5377 // class I2 { set s(num); } 5385 // class I2 { set s(num); }
5378 // class A implements I1, I2 {} 5386 // class A implements I1, I2 {}
5379 ClassElementImpl classI1 = ElementFactory.classElement2("I1"); 5387 ClassElementImpl classI1 = ElementFactory.classElement2("I1");
5380 String accessorName = "s"; 5388 String accessorName = "s";
5381 PropertyAccessorElement setter1 = ElementFactory.setterElement( 5389 PropertyAccessorElement setter1 = ElementFactory.setterElement(
5382 accessorName, false, _typeProvider.intType); 5390 accessorName, false, _typeProvider.intType);
5383 classI1.accessors = <PropertyAccessorElement>[setter1]; 5391 classI1.accessors = <PropertyAccessorElement>[setter1];
5384 ClassElementImpl classI2 = ElementFactory.classElement2("I2"); 5392 ClassElementImpl classI2 = ElementFactory.classElement2("I2");
5385 PropertyAccessorElement setter2 = ElementFactory.setterElement( 5393 PropertyAccessorElement setter2 = ElementFactory.setterElement(
5386 accessorName, false, _typeProvider.numType); 5394 accessorName, false, _typeProvider.numType);
5387 classI2.accessors = <PropertyAccessorElement>[setter2]; 5395 classI2.accessors = <PropertyAccessorElement>[setter2];
5388 ClassElementImpl classA = ElementFactory.classElement2("A"); 5396 ClassElementImpl classA = ElementFactory.classElement2("A");
5389 classA.interfaces = <InterfaceType>[classI1.type, classI2.type]; 5397 classA.interfaces = <InterfaceType>[classI1.type, classI2.type];
5390 MemberMap mapA = 5398 MemberMap mapA =
5391 _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classA); 5399 _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classA);
5392 expect(mapA.size, _numOfMembersInObject + 1); 5400 expect(mapA.size, _numOfMembersInObject + 1);
5393 PropertyAccessorElementImpl syntheticAccessor = ElementFactory 5401 PropertyAccessorElementImpl syntheticAccessor = ElementFactory
5394 .setterElement(accessorName, false, _typeProvider.dynamicType); 5402 .setterElement(accessorName, false, _typeProvider.dynamicType);
5395 syntheticAccessor.returnType = _typeProvider.dynamicType; 5403 syntheticAccessor.returnType = _typeProvider.dynamicType;
5396 expect(mapA.get("$accessorName=").type, syntheticAccessor.type); 5404 expect(mapA.get("$accessorName=").type, syntheticAccessor.type);
5397 _assertNoErrors(classA); 5405 _assertNoErrors(classA);
5398 } 5406 }
5399 5407
5400 void test_getMapOfMembersInheritedFromInterfaces_union_multipleSubtypes_3_gett ers() { 5408 void
5409 test_getMapOfMembersInheritedFromInterfaces_union_multipleSubtypes_3_gette rs() {
5401 // class A {} 5410 // class A {}
5402 // class B extends A {} 5411 // class B extends A {}
5403 // class C extends B {} 5412 // class C extends B {}
5404 // class I1 { A get g; } 5413 // class I1 { A get g; }
5405 // class I2 { B get g; } 5414 // class I2 { B get g; }
5406 // class I3 { C get g; } 5415 // class I3 { C get g; }
5407 // class D implements I1, I2, I3 {} 5416 // class D implements I1, I2, I3 {}
5408 ClassElementImpl classA = ElementFactory.classElement2("A"); 5417 ClassElementImpl classA = ElementFactory.classElement2("A");
5409 ClassElementImpl classB = ElementFactory.classElement("B", classA.type); 5418 ClassElementImpl classB = ElementFactory.classElement("B", classA.type);
5410 ClassElementImpl classC = ElementFactory.classElement("C", classB.type); 5419 ClassElementImpl classC = ElementFactory.classElement("C", classB.type);
(...skipping 18 matching lines...) Expand all
5429 ]; 5438 ];
5430 MemberMap mapD = 5439 MemberMap mapD =
5431 _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classD); 5440 _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classD);
5432 expect(mapD.size, _numOfMembersInObject + 1); 5441 expect(mapD.size, _numOfMembersInObject + 1);
5433 PropertyAccessorElement syntheticAccessor = ElementFactory.getterElement( 5442 PropertyAccessorElement syntheticAccessor = ElementFactory.getterElement(
5434 accessorName, false, _typeProvider.dynamicType); 5443 accessorName, false, _typeProvider.dynamicType);
5435 expect(mapD.get(accessorName).type, syntheticAccessor.type); 5444 expect(mapD.get(accessorName).type, syntheticAccessor.type);
5436 _assertNoErrors(classD); 5445 _assertNoErrors(classD);
5437 } 5446 }
5438 5447
5439 void test_getMapOfMembersInheritedFromInterfaces_union_multipleSubtypes_3_meth ods() { 5448 void
5449 test_getMapOfMembersInheritedFromInterfaces_union_multipleSubtypes_3_metho ds() {
5440 // class A {} 5450 // class A {}
5441 // class B extends A {} 5451 // class B extends A {}
5442 // class C extends B {} 5452 // class C extends B {}
5443 // class I1 { dynamic m(A a); } 5453 // class I1 { dynamic m(A a); }
5444 // class I2 { dynamic m(B b); } 5454 // class I2 { dynamic m(B b); }
5445 // class I3 { dynamic m(C c); } 5455 // class I3 { dynamic m(C c); }
5446 // class D implements I1, I2, I3 {} 5456 // class D implements I1, I2, I3 {}
5447 ClassElementImpl classA = ElementFactory.classElement2("A"); 5457 ClassElementImpl classA = ElementFactory.classElement2("A");
5448 ClassElementImpl classB = ElementFactory.classElement("B", classA.type); 5458 ClassElementImpl classB = ElementFactory.classElement("B", classA.type);
5449 ClassElementImpl classC = ElementFactory.classElement("C", classB.type); 5459 ClassElementImpl classC = ElementFactory.classElement("C", classB.type);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
5483 ]; 5493 ];
5484 MemberMap mapD = 5494 MemberMap mapD =
5485 _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classD); 5495 _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classD);
5486 expect(mapD.size, _numOfMembersInObject + 1); 5496 expect(mapD.size, _numOfMembersInObject + 1);
5487 MethodElement syntheticMethod = ElementFactory.methodElement( 5497 MethodElement syntheticMethod = ElementFactory.methodElement(
5488 methodName, _typeProvider.dynamicType, [_typeProvider.dynamicType]); 5498 methodName, _typeProvider.dynamicType, [_typeProvider.dynamicType]);
5489 expect(mapD.get(methodName).type, syntheticMethod.type); 5499 expect(mapD.get(methodName).type, syntheticMethod.type);
5490 _assertNoErrors(classD); 5500 _assertNoErrors(classD);
5491 } 5501 }
5492 5502
5493 void test_getMapOfMembersInheritedFromInterfaces_union_multipleSubtypes_3_sett ers() { 5503 void
5504 test_getMapOfMembersInheritedFromInterfaces_union_multipleSubtypes_3_sette rs() {
5494 // class A {} 5505 // class A {}
5495 // class B extends A {} 5506 // class B extends A {}
5496 // class C extends B {} 5507 // class C extends B {}
5497 // class I1 { set s(A); } 5508 // class I1 { set s(A); }
5498 // class I2 { set s(B); } 5509 // class I2 { set s(B); }
5499 // class I3 { set s(C); } 5510 // class I3 { set s(C); }
5500 // class D implements I1, I2, I3 {} 5511 // class D implements I1, I2, I3 {}
5501 ClassElementImpl classA = ElementFactory.classElement2("A"); 5512 ClassElementImpl classA = ElementFactory.classElement2("A");
5502 ClassElementImpl classB = ElementFactory.classElement("B", classA.type); 5513 ClassElementImpl classB = ElementFactory.classElement("B", classA.type);
5503 ClassElementImpl classC = ElementFactory.classElement("C", classB.type); 5514 ClassElementImpl classC = ElementFactory.classElement("C", classB.type);
(...skipping 19 matching lines...) Expand all
5523 MemberMap mapD = 5534 MemberMap mapD =
5524 _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classD); 5535 _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classD);
5525 expect(mapD.size, _numOfMembersInObject + 1); 5536 expect(mapD.size, _numOfMembersInObject + 1);
5526 PropertyAccessorElementImpl syntheticAccessor = ElementFactory 5537 PropertyAccessorElementImpl syntheticAccessor = ElementFactory
5527 .setterElement(accessorName, false, _typeProvider.dynamicType); 5538 .setterElement(accessorName, false, _typeProvider.dynamicType);
5528 syntheticAccessor.returnType = _typeProvider.dynamicType; 5539 syntheticAccessor.returnType = _typeProvider.dynamicType;
5529 expect(mapD.get("$accessorName=").type, syntheticAccessor.type); 5540 expect(mapD.get("$accessorName=").type, syntheticAccessor.type);
5530 _assertNoErrors(classD); 5541 _assertNoErrors(classD);
5531 } 5542 }
5532 5543
5533 void test_getMapOfMembersInheritedFromInterfaces_union_oneSubtype_2_methods() { 5544 void
5545 test_getMapOfMembersInheritedFromInterfaces_union_oneSubtype_2_methods() {
5534 // class I1 { int m(); } 5546 // class I1 { int m(); }
5535 // class I2 { int m([int]); } 5547 // class I2 { int m([int]); }
5536 // class A implements I1, I2 {} 5548 // class A implements I1, I2 {}
5537 ClassElementImpl classI1 = ElementFactory.classElement2("I1"); 5549 ClassElementImpl classI1 = ElementFactory.classElement2("I1");
5538 String methodName = "m"; 5550 String methodName = "m";
5539 MethodElement methodM1 = 5551 MethodElement methodM1 =
5540 ElementFactory.methodElement(methodName, _typeProvider.intType); 5552 ElementFactory.methodElement(methodName, _typeProvider.intType);
5541 classI1.methods = <MethodElement>[methodM1]; 5553 classI1.methods = <MethodElement>[methodM1];
5542 ClassElementImpl classI2 = ElementFactory.classElement2("I2"); 5554 ClassElementImpl classI2 = ElementFactory.classElement2("I2");
5543 MethodElementImpl methodM2 = 5555 MethodElementImpl methodM2 =
5544 ElementFactory.methodElement(methodName, _typeProvider.intType); 5556 ElementFactory.methodElement(methodName, _typeProvider.intType);
5545 ParameterElementImpl parameter1 = 5557 ParameterElementImpl parameter1 =
5546 new ParameterElementImpl.forNode(AstFactory.identifier3("a1")); 5558 new ParameterElementImpl.forNode(AstFactory.identifier3("a1"));
5547 parameter1.type = _typeProvider.intType; 5559 parameter1.type = _typeProvider.intType;
5548 parameter1.parameterKind = ParameterKind.POSITIONAL; 5560 parameter1.parameterKind = ParameterKind.POSITIONAL;
5549 methodM2.parameters = <ParameterElement>[parameter1]; 5561 methodM2.parameters = <ParameterElement>[parameter1];
5550 classI2.methods = <MethodElement>[methodM2]; 5562 classI2.methods = <MethodElement>[methodM2];
5551 ClassElementImpl classA = ElementFactory.classElement2("A"); 5563 ClassElementImpl classA = ElementFactory.classElement2("A");
5552 classA.interfaces = <InterfaceType>[classI1.type, classI2.type]; 5564 classA.interfaces = <InterfaceType>[classI1.type, classI2.type];
5553 MemberMap mapA = 5565 MemberMap mapA =
5554 _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classA); 5566 _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classA);
5555 expect(mapA.size, _numOfMembersInObject + 1); 5567 expect(mapA.size, _numOfMembersInObject + 1);
5556 expect(mapA.get(methodName), same(methodM2)); 5568 expect(mapA.get(methodName), same(methodM2));
5557 _assertNoErrors(classA); 5569 _assertNoErrors(classA);
5558 } 5570 }
5559 5571
5560 void test_getMapOfMembersInheritedFromInterfaces_union_oneSubtype_3_methods() { 5572 void
5573 test_getMapOfMembersInheritedFromInterfaces_union_oneSubtype_3_methods() {
5561 // class I1 { int m(); } 5574 // class I1 { int m(); }
5562 // class I2 { int m([int]); } 5575 // class I2 { int m([int]); }
5563 // class I3 { int m([int, int]); } 5576 // class I3 { int m([int, int]); }
5564 // class A implements I1, I2, I3 {} 5577 // class A implements I1, I2, I3 {}
5565 ClassElementImpl classI1 = ElementFactory.classElement2("I1"); 5578 ClassElementImpl classI1 = ElementFactory.classElement2("I1");
5566 String methodName = "m"; 5579 String methodName = "m";
5567 MethodElementImpl methodM1 = 5580 MethodElementImpl methodM1 =
5568 ElementFactory.methodElement(methodName, _typeProvider.intType); 5581 ElementFactory.methodElement(methodName, _typeProvider.intType);
5569 classI1.methods = <MethodElement>[methodM1]; 5582 classI1.methods = <MethodElement>[methodM1];
5570 ClassElementImpl classI2 = ElementFactory.classElement2("I2"); 5583 ClassElementImpl classI2 = ElementFactory.classElement2("I2");
(...skipping 24 matching lines...) Expand all
5595 classI2.type, 5608 classI2.type,
5596 classI3.type 5609 classI3.type
5597 ]; 5610 ];
5598 MemberMap mapA = 5611 MemberMap mapA =
5599 _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classA); 5612 _inheritanceManager.getMapOfMembersInheritedFromInterfaces(classA);
5600 expect(mapA.size, _numOfMembersInObject + 1); 5613 expect(mapA.size, _numOfMembersInObject + 1);
5601 expect(mapA.get(methodName), same(methodM3)); 5614 expect(mapA.get(methodName), same(methodM3));
5602 _assertNoErrors(classA); 5615 _assertNoErrors(classA);
5603 } 5616 }
5604 5617
5605 void test_getMapOfMembersInheritedFromInterfaces_union_oneSubtype_4_methods() { 5618 void
5619 test_getMapOfMembersInheritedFromInterfaces_union_oneSubtype_4_methods() {
5606 // class I1 { int m(); } 5620 // class I1 { int m(); }
5607 // class I2 { int m(); } 5621 // class I2 { int m(); }
5608 // class I3 { int m([int]); } 5622 // class I3 { int m([int]); }
5609 // class I4 { int m([int, int]); } 5623 // class I4 { int m([int, int]); }
5610 // class A implements I1, I2, I3, I4 {} 5624 // class A implements I1, I2, I3, I4 {}
5611 ClassElementImpl classI1 = ElementFactory.classElement2("I1"); 5625 ClassElementImpl classI1 = ElementFactory.classElement2("I1");
5612 String methodName = "m"; 5626 String methodName = "m";
5613 MethodElement methodM1 = 5627 MethodElement methodM1 =
5614 ElementFactory.methodElement(methodName, _typeProvider.intType); 5628 ElementFactory.methodElement(methodName, _typeProvider.intType);
5615 classI1.methods = <MethodElement>[methodM1]; 5629 classI1.methods = <MethodElement>[methodM1];
(...skipping 3681 matching lines...) Expand 10 before | Expand all | Expand 10 after
9297 expect(classes, hasLength(1)); 9311 expect(classes, hasLength(1));
9298 List<ElementAnnotation> annotations = classes[0].metadata; 9312 List<ElementAnnotation> annotations = classes[0].metadata;
9299 expect(annotations, hasLength(1)); 9313 expect(annotations, hasLength(1));
9300 assertNoErrors(source); 9314 assertNoErrors(source);
9301 verify([source]); 9315 verify([source]);
9302 CompilationUnit unit = resolveCompilationUnit(source, library); 9316 CompilationUnit unit = resolveCompilationUnit(source, library);
9303 NodeList<CompilationUnitMember> declarations = unit.declarations; 9317 NodeList<CompilationUnitMember> declarations = unit.declarations;
9304 expect(declarations, hasLength(2)); 9318 expect(declarations, hasLength(2));
9305 Element expectedElement = (declarations[0] as TopLevelVariableDeclaration) 9319 Element expectedElement = (declarations[0] as TopLevelVariableDeclaration)
9306 .variables 9320 .variables
9307 .variables[0].name.staticElement; 9321 .variables[0]
9322 .name
9323 .staticElement;
9308 EngineTestCase.assertInstanceOf((obj) => obj is PropertyInducingElement, 9324 EngineTestCase.assertInstanceOf((obj) => obj is PropertyInducingElement,
9309 PropertyInducingElement, expectedElement); 9325 PropertyInducingElement, expectedElement);
9310 expectedElement = (expectedElement as PropertyInducingElement).getter; 9326 expectedElement = (expectedElement as PropertyInducingElement).getter;
9311 Element actualElement = 9327 Element actualElement =
9312 (declarations[1] as ClassDeclaration).metadata[0].name.staticElement; 9328 (declarations[1] as ClassDeclaration).metadata[0].name.staticElement;
9313 expect(actualElement, same(expectedElement)); 9329 expect(actualElement, same(expectedElement));
9314 } 9330 }
9315 9331
9316 void test_metadata_field() { 9332 void test_metadata_field() {
9317 Source source = addSource(r''' 9333 Source source = addSource(r'''
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
9488 expect(aliases, hasLength(1)); 9504 expect(aliases, hasLength(1));
9489 List<ElementAnnotation> annotations = aliases[0].metadata; 9505 List<ElementAnnotation> annotations = aliases[0].metadata;
9490 expect(annotations, hasLength(1)); 9506 expect(annotations, hasLength(1));
9491 assertNoErrors(source); 9507 assertNoErrors(source);
9492 verify([source]); 9508 verify([source]);
9493 CompilationUnit unit = resolveCompilationUnit(source, library); 9509 CompilationUnit unit = resolveCompilationUnit(source, library);
9494 NodeList<CompilationUnitMember> declarations = unit.declarations; 9510 NodeList<CompilationUnitMember> declarations = unit.declarations;
9495 expect(declarations, hasLength(2)); 9511 expect(declarations, hasLength(2));
9496 Element expectedElement = (declarations[0] as TopLevelVariableDeclaration) 9512 Element expectedElement = (declarations[0] as TopLevelVariableDeclaration)
9497 .variables 9513 .variables
9498 .variables[0].name.staticElement; 9514 .variables[0]
9515 .name
9516 .staticElement;
9499 EngineTestCase.assertInstanceOf((obj) => obj is PropertyInducingElement, 9517 EngineTestCase.assertInstanceOf((obj) => obj is PropertyInducingElement,
9500 PropertyInducingElement, expectedElement); 9518 PropertyInducingElement, expectedElement);
9501 expectedElement = (expectedElement as PropertyInducingElement).getter; 9519 expectedElement = (expectedElement as PropertyInducingElement).getter;
9502 Element actualElement = 9520 Element actualElement =
9503 (declarations[1] as FunctionTypeAlias).metadata[0].name.staticElement; 9521 (declarations[1] as FunctionTypeAlias).metadata[0].name.staticElement;
9504 expect(actualElement, same(expectedElement)); 9522 expect(actualElement, same(expectedElement));
9505 } 9523 }
9506 9524
9507 void test_method_fromMixin() { 9525 void test_method_fromMixin() {
9508 Source source = addSource(r''' 9526 Source source = addSource(r'''
(...skipping 2202 matching lines...) Expand 10 before | Expand all | Expand 10 after
11711 } 11729 }
11712 11730
11713 /** 11731 /**
11714 * Strong mode static analyzer downwards inference tests 11732 * Strong mode static analyzer downwards inference tests
11715 */ 11733 */
11716 @reflectiveTest 11734 @reflectiveTest
11717 class StrongModeDownwardsInferenceTest extends ResolverTestCase { 11735 class StrongModeDownwardsInferenceTest extends ResolverTestCase {
11718 TypeAssertions _assertions; 11736 TypeAssertions _assertions;
11719 AsserterBuilder<Element, DartType> _hasElement; 11737 AsserterBuilder<Element, DartType> _hasElement;
11720 AsserterBuilder<DartType, DartType> _isType; 11738 AsserterBuilder<DartType, DartType> _isType;
11721 AsserterBuilder2<Asserter<DartType>, Asserter<DartType>, 11739 AsserterBuilder2<Asserter<DartType>, Asserter<DartType>, DartType>
11722 DartType> _isFunction2Of; 11740 _isFunction2Of;
11723 AsserterBuilderBuilder<Asserter<DartType>, List<Asserter<DartType>>, 11741 AsserterBuilderBuilder<Asserter<DartType>, List<Asserter<DartType>>, DartType>
11724 DartType> _isInstantiationOf; 11742 _isInstantiationOf;
11725 Asserter<DartType> _isInt; 11743 Asserter<DartType> _isInt;
11726 Asserter<DartType> _isNum; 11744 Asserter<DartType> _isNum;
11727 Asserter<DartType> _isString; 11745 Asserter<DartType> _isString;
11728 Asserter<DartType> _isDynamic; 11746 Asserter<DartType> _isDynamic;
11729 AsserterBuilder<Asserter<DartType>, InterfaceType> _isListOf; 11747 AsserterBuilder<Asserter<DartType>, InterfaceType> _isListOf;
11730 AsserterBuilder2<Asserter<DartType>, Asserter<DartType>, 11748 AsserterBuilder2<Asserter<DartType>, Asserter<DartType>, InterfaceType>
11731 InterfaceType> _isMapOf; 11749 _isMapOf;
11732 11750
11733 @override 11751 @override
11734 void setUp() { 11752 void setUp() {
11735 AnalysisOptionsImpl options = new AnalysisOptionsImpl(); 11753 AnalysisOptionsImpl options = new AnalysisOptionsImpl();
11736 options.strongMode = true; 11754 options.strongMode = true;
11737 resetWithOptions(options); 11755 resetWithOptions(options);
11738 _assertions = new TypeAssertions(typeProvider); 11756 _assertions = new TypeAssertions(typeProvider);
11739 _isType = _assertions.isType; 11757 _isType = _assertions.isType;
11740 _hasElement = _assertions.hasElement; 11758 _hasElement = _assertions.hasElement;
11741 _isInstantiationOf = _assertions.isInstantiationOf; 11759 _isInstantiationOf = _assertions.isInstantiationOf;
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
12165 expect(functionReturnValue(4).staticType, typeProvider.stringType); 12183 expect(functionReturnValue(4).staticType, typeProvider.stringType);
12166 } 12184 }
12167 12185
12168 void test_inference_hints() { 12186 void test_inference_hints() {
12169 Source source = addSource(r''' 12187 Source source = addSource(r'''
12170 void main () { 12188 void main () {
12171 var x = 3; 12189 var x = 3;
12172 List<int> l0 = []; 12190 List<int> l0 = [];
12173 } 12191 }
12174 '''); 12192 ''');
12175 LibraryElement library = resolve2(source); 12193 resolve2(source);
12176 assertNoErrors(source); 12194 assertNoErrors(source);
12177 verify([source]); 12195 verify([source]);
12178 } 12196 }
12179 12197
12180 void test_instanceCreation() { 12198 void test_instanceCreation() {
12181 String code = r''' 12199 String code = r'''
12182 class A<S, T> { 12200 class A<S, T> {
12183 S x; 12201 S x;
12184 T y; 12202 T y;
12185 A(this.x, this.y); 12203 A(this.x, this.y);
(...skipping 1766 matching lines...) Expand 10 before | Expand all | Expand 10 after
13952 import 'lib.dart'; 13970 import 'lib.dart';
13953 class B extends A { 13971 class B extends A {
13954 m() { 13972 m() {
13955 return v; // marker 13973 return v; // marker
13956 } 13974 }
13957 }'''; 13975 }''';
13958 _assertTypeOfMarkedExpression( 13976 _assertTypeOfMarkedExpression(
13959 code, typeProvider.dynamicType, typeProvider.intType); 13977 code, typeProvider.dynamicType, typeProvider.intType);
13960 } 13978 }
13961 13979
13962 void test_finalPropertyInducingVariable_classMember_instance_propagatedTarget( ) { 13980 void
13981 test_finalPropertyInducingVariable_classMember_instance_propagatedTarget() {
13963 addNamedSource( 13982 addNamedSource(
13964 "/lib.dart", 13983 "/lib.dart",
13965 r''' 13984 r'''
13966 class A { 13985 class A {
13967 final v = 0; 13986 final v = 0;
13968 }'''); 13987 }''');
13969 String code = r''' 13988 String code = r'''
13970 import 'lib.dart'; 13989 import 'lib.dart';
13971 f(p) { 13990 f(p) {
13972 if (p is A) { 13991 if (p is A) {
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
14171 FormalParameter kParameter = EngineTestCase.findNode( 14190 FormalParameter kParameter = EngineTestCase.findNode(
14172 unit, code, "k, ", (node) => node is SimpleFormalParameter); 14191 unit, code, "k, ", (node) => node is SimpleFormalParameter);
14173 expect(kParameter.identifier.propagatedType, same(intType)); 14192 expect(kParameter.identifier.propagatedType, same(intType));
14174 // v 14193 // v
14175 DartType stringType = typeProvider.stringType; 14194 DartType stringType = typeProvider.stringType;
14176 FormalParameter vParameter = EngineTestCase.findNode( 14195 FormalParameter vParameter = EngineTestCase.findNode(
14177 unit, code, "v)", (node) => node is SimpleFormalParameter); 14196 unit, code, "v)", (node) => node is SimpleFormalParameter);
14178 expect(vParameter.identifier.propagatedType, same(stringType)); 14197 expect(vParameter.identifier.propagatedType, same(stringType));
14179 } 14198 }
14180 14199
14181 void test_functionExpression_asInvocationArgument_functionExpressionInvocation () { 14200 void
14201 test_functionExpression_asInvocationArgument_functionExpressionInvocation( ) {
14182 String code = r''' 14202 String code = r'''
14183 main() { 14203 main() {
14184 (f(String value)) {} ((v) { 14204 (f(String value)) {} ((v) {
14185 v; 14205 v;
14186 }); 14206 });
14187 }'''; 14207 }''';
14188 Source source = addSource(code); 14208 Source source = addSource(code);
14189 LibraryElement library = resolve2(source); 14209 LibraryElement library = resolve2(source);
14190 assertNoErrors(source); 14210 assertNoErrors(source);
14191 verify([source]); 14211 verify([source]);
(...skipping 1857 matching lines...) Expand 10 before | Expand all | Expand 10 after
16049 16069
16050 void _resolveTestUnit(String code) { 16070 void _resolveTestUnit(String code) {
16051 testCode = code; 16071 testCode = code;
16052 testSource = addSource(testCode); 16072 testSource = addSource(testCode);
16053 LibraryElement library = resolve2(testSource); 16073 LibraryElement library = resolve2(testSource);
16054 assertNoErrors(testSource); 16074 assertNoErrors(testSource);
16055 verify([testSource]); 16075 verify([testSource]);
16056 testUnit = resolveCompilationUnit(testSource, library); 16076 testUnit = resolveCompilationUnit(testSource, library);
16057 } 16077 }
16058 } 16078 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/parser_test.dart ('k') | pkg/analyzer/test/generated/scanner_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698