OLD | NEW |
1 // This code was auto-generated, is not intended to be edited, and is subject to | 1 // This code was auto-generated, is not intended to be edited, and is subject to |
2 // significant change. Please see the README file for more information. | 2 // significant change. Please see the README file for more information. |
3 | 3 |
4 library engine.element_test; | 4 library engine.element_test; |
5 | 5 |
6 import 'dart:collection'; | 6 import 'dart:collection'; |
7 import 'dart:io'; | 7 import 'dart:io'; |
8 import 'package:analyzer_experimental/src/generated/java_core.dart'; | 8 import 'package:analyzer_experimental/src/generated/java_core.dart'; |
9 import 'package:analyzer_experimental/src/generated/java_engine.dart'; | 9 import 'package:analyzer_experimental/src/generated/java_engine.dart'; |
10 import 'package:analyzer_experimental/src/generated/java_engine_io.dart'; | 10 import 'package:analyzer_experimental/src/generated/java_engine_io.dart'; |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 runJUnitTest(__test, __test.test_isUpToDate); | 166 runJUnitTest(__test, __test.test_isUpToDate); |
167 }); | 167 }); |
168 _ut.test('test_setImports', () { | 168 _ut.test('test_setImports', () { |
169 final __test = new LibraryElementImplTest(); | 169 final __test = new LibraryElementImplTest(); |
170 runJUnitTest(__test, __test.test_setImports); | 170 runJUnitTest(__test, __test.test_setImports); |
171 }); | 171 }); |
172 }); | 172 }); |
173 } | 173 } |
174 } | 174 } |
175 class InterfaceTypeImplTest extends EngineTestCase { | 175 class InterfaceTypeImplTest extends EngineTestCase { |
| 176 |
176 /** | 177 /** |
177 * The type provider used to access the types. | 178 * The type provider used to access the types. |
178 */ | 179 */ |
179 TestTypeProvider _typeProvider; | 180 TestTypeProvider _typeProvider; |
180 void setUp() { | 181 void setUp() { |
181 _typeProvider = new TestTypeProvider(); | 182 _typeProvider = new TestTypeProvider(); |
182 } | 183 } |
183 void test_computeLongestInheritancePathToObject_multipleInterfacePaths() { | 184 void test_computeLongestInheritancePathToObject_multipleInterfacePaths() { |
184 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 185 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
185 ClassElementImpl classB = ElementFactory.classElement2("B", []); | 186 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
(...skipping 15 matching lines...) Expand all Loading... |
201 ClassElementImpl classE = ElementFactory.classElement("E", classB.type, []); | 202 ClassElementImpl classE = ElementFactory.classElement("E", classB.type, []); |
202 classE.interfaces = <InterfaceType> [classD.type]; | 203 classE.interfaces = <InterfaceType> [classD.type]; |
203 JUnitTestCase.assertEquals(2, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classB.type)); | 204 JUnitTestCase.assertEquals(2, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classB.type)); |
204 JUnitTestCase.assertEquals(4, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classE.type)); | 205 JUnitTestCase.assertEquals(4, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classE.type)); |
205 } | 206 } |
206 void test_computeLongestInheritancePathToObject_object() { | 207 void test_computeLongestInheritancePathToObject_object() { |
207 ClassElement classA = ElementFactory.classElement2("A", []); | 208 ClassElement classA = ElementFactory.classElement2("A", []); |
208 InterfaceType object = classA.supertype; | 209 InterfaceType object = classA.supertype; |
209 JUnitTestCase.assertEquals(0, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(object)); | 210 JUnitTestCase.assertEquals(0, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(object)); |
210 } | 211 } |
| 212 void test_computeLongestInheritancePathToObject_recursion() { |
| 213 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 214 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 215 classA.supertype = classB.type; |
| 216 JUnitTestCase.assertEquals(2, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classA.type)); |
| 217 } |
211 void test_computeLongestInheritancePathToObject_singleInterfacePath() { | 218 void test_computeLongestInheritancePathToObject_singleInterfacePath() { |
212 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 219 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
213 ClassElementImpl classB = ElementFactory.classElement2("B", []); | 220 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
214 ClassElementImpl classC = ElementFactory.classElement2("C", []); | 221 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
215 classB.interfaces = <InterfaceType> [classA.type]; | 222 classB.interfaces = <InterfaceType> [classA.type]; |
216 classC.interfaces = <InterfaceType> [classB.type]; | 223 classC.interfaces = <InterfaceType> [classB.type]; |
217 JUnitTestCase.assertEquals(1, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classA.type)); | 224 JUnitTestCase.assertEquals(1, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classA.type)); |
218 JUnitTestCase.assertEquals(2, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classB.type)); | 225 JUnitTestCase.assertEquals(2, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classB.type)); |
219 JUnitTestCase.assertEquals(3, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classC.type)); | 226 JUnitTestCase.assertEquals(3, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classC.type)); |
220 } | 227 } |
221 void test_computeLongestInheritancePathToObject_singleSuperclassPath() { | 228 void test_computeLongestInheritancePathToObject_singleSuperclassPath() { |
222 ClassElement classA = ElementFactory.classElement2("A", []); | 229 ClassElement classA = ElementFactory.classElement2("A", []); |
223 ClassElement classB = ElementFactory.classElement("B", classA.type, []); | 230 ClassElement classB = ElementFactory.classElement("B", classA.type, []); |
224 ClassElement classC = ElementFactory.classElement("C", classB.type, []); | 231 ClassElement classC = ElementFactory.classElement("C", classB.type, []); |
225 JUnitTestCase.assertEquals(1, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classA.type)); | 232 JUnitTestCase.assertEquals(1, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classA.type)); |
226 JUnitTestCase.assertEquals(2, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classB.type)); | 233 JUnitTestCase.assertEquals(2, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classB.type)); |
227 JUnitTestCase.assertEquals(3, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classC.type)); | 234 JUnitTestCase.assertEquals(3, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classC.type)); |
228 } | 235 } |
229 void test_computeSuperinterfaceSet_multipleInterfacePaths() { | 236 void test_computeSuperinterfaceSet_multipleInterfacePaths() { |
230 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 237 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
231 ClassElementImpl classB = ElementFactory.classElement2("B", []); | 238 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
232 ClassElementImpl classC = ElementFactory.classElement2("C", []); | 239 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
233 ClassElementImpl classD = ElementFactory.classElement2("D", []); | 240 ClassElementImpl classD = ElementFactory.classElement2("D", []); |
234 ClassElementImpl classE = ElementFactory.classElement2("E", []); | 241 ClassElementImpl classE = ElementFactory.classElement2("E", []); |
235 classB.interfaces = <InterfaceType> [classA.type]; | 242 classB.interfaces = <InterfaceType> [classA.type]; |
236 classC.interfaces = <InterfaceType> [classA.type]; | 243 classC.interfaces = <InterfaceType> [classA.type]; |
237 classD.interfaces = <InterfaceType> [classC.type]; | 244 classD.interfaces = <InterfaceType> [classC.type]; |
238 classE.interfaces = <InterfaceType> [classB.type, classD.type]; | 245 classE.interfaces = <InterfaceType> [classB.type, classD.type]; |
239 Set<InterfaceType> superinterfacesOfD = InterfaceTypeImpl.computeSuperinterf
aceSet(classD.type); | 246 Set<InterfaceType> superinterfacesOfD = InterfaceTypeImpl.computeSuperinterf
aceSet(classD.type); |
240 JUnitTestCase.assertNotNull(superinterfacesOfD); | 247 EngineTestCase.assertSize3(3, superinterfacesOfD); |
241 JUnitTestCase.assertTrue(superinterfacesOfD.contains(ElementFactory.object.t
ype)); | 248 JUnitTestCase.assertTrue(superinterfacesOfD.contains(ElementFactory.object.t
ype)); |
242 JUnitTestCase.assertTrue(superinterfacesOfD.contains(classA.type)); | 249 JUnitTestCase.assertTrue(superinterfacesOfD.contains(classA.type)); |
243 JUnitTestCase.assertTrue(superinterfacesOfD.contains(classC.type)); | 250 JUnitTestCase.assertTrue(superinterfacesOfD.contains(classC.type)); |
244 JUnitTestCase.assertEquals(3, superinterfacesOfD.length); | |
245 Set<InterfaceType> superinterfacesOfE = InterfaceTypeImpl.computeSuperinterf
aceSet(classE.type); | 251 Set<InterfaceType> superinterfacesOfE = InterfaceTypeImpl.computeSuperinterf
aceSet(classE.type); |
246 JUnitTestCase.assertNotNull(superinterfacesOfE); | 252 EngineTestCase.assertSize3(5, superinterfacesOfE); |
247 JUnitTestCase.assertTrue(superinterfacesOfE.contains(ElementFactory.object.t
ype)); | 253 JUnitTestCase.assertTrue(superinterfacesOfE.contains(ElementFactory.object.t
ype)); |
248 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classA.type)); | 254 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classA.type)); |
249 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classB.type)); | 255 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classB.type)); |
250 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classC.type)); | 256 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classC.type)); |
251 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classD.type)); | 257 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classD.type)); |
252 JUnitTestCase.assertEquals(5, superinterfacesOfE.length); | |
253 } | 258 } |
254 void test_computeSuperinterfaceSet_multipleSuperclassPaths() { | 259 void test_computeSuperinterfaceSet_multipleSuperclassPaths() { |
255 ClassElement classA = ElementFactory.classElement2("A", []); | 260 ClassElement classA = ElementFactory.classElement2("A", []); |
256 ClassElement classB = ElementFactory.classElement("B", classA.type, []); | 261 ClassElement classB = ElementFactory.classElement("B", classA.type, []); |
257 ClassElement classC = ElementFactory.classElement("C", classA.type, []); | 262 ClassElement classC = ElementFactory.classElement("C", classA.type, []); |
258 ClassElement classD = ElementFactory.classElement("D", classC.type, []); | 263 ClassElement classD = ElementFactory.classElement("D", classC.type, []); |
259 ClassElementImpl classE = ElementFactory.classElement("E", classB.type, []); | 264 ClassElementImpl classE = ElementFactory.classElement("E", classB.type, []); |
260 classE.interfaces = <InterfaceType> [classD.type]; | 265 classE.interfaces = <InterfaceType> [classD.type]; |
261 Set<InterfaceType> superinterfacesOfD = InterfaceTypeImpl.computeSuperinterf
aceSet(classD.type); | 266 Set<InterfaceType> superinterfacesOfD = InterfaceTypeImpl.computeSuperinterf
aceSet(classD.type); |
262 JUnitTestCase.assertNotNull(superinterfacesOfD); | 267 EngineTestCase.assertSize3(3, superinterfacesOfD); |
263 JUnitTestCase.assertTrue(superinterfacesOfD.contains(ElementFactory.object.t
ype)); | 268 JUnitTestCase.assertTrue(superinterfacesOfD.contains(ElementFactory.object.t
ype)); |
264 JUnitTestCase.assertTrue(superinterfacesOfD.contains(classA.type)); | 269 JUnitTestCase.assertTrue(superinterfacesOfD.contains(classA.type)); |
265 JUnitTestCase.assertTrue(superinterfacesOfD.contains(classC.type)); | 270 JUnitTestCase.assertTrue(superinterfacesOfD.contains(classC.type)); |
266 JUnitTestCase.assertEquals(3, superinterfacesOfD.length); | |
267 Set<InterfaceType> superinterfacesOfE = InterfaceTypeImpl.computeSuperinterf
aceSet(classE.type); | 271 Set<InterfaceType> superinterfacesOfE = InterfaceTypeImpl.computeSuperinterf
aceSet(classE.type); |
268 JUnitTestCase.assertNotNull(superinterfacesOfE); | 272 EngineTestCase.assertSize3(5, superinterfacesOfE); |
269 JUnitTestCase.assertTrue(superinterfacesOfE.contains(ElementFactory.object.t
ype)); | 273 JUnitTestCase.assertTrue(superinterfacesOfE.contains(ElementFactory.object.t
ype)); |
270 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classA.type)); | 274 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classA.type)); |
271 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classB.type)); | 275 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classB.type)); |
272 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classC.type)); | 276 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classC.type)); |
273 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classD.type)); | 277 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classD.type)); |
274 JUnitTestCase.assertEquals(5, superinterfacesOfE.length); | 278 } |
| 279 void test_computeSuperinterfaceSet_recursion() { |
| 280 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 281 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 282 classA.supertype = classB.type; |
| 283 Set<InterfaceType> superinterfacesOfB = InterfaceTypeImpl.computeSuperinterf
aceSet(classB.type); |
| 284 EngineTestCase.assertSize3(2, superinterfacesOfB); |
275 } | 285 } |
276 void test_computeSuperinterfaceSet_singleInterfacePath() { | 286 void test_computeSuperinterfaceSet_singleInterfacePath() { |
277 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 287 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
278 ClassElementImpl classB = ElementFactory.classElement2("B", []); | 288 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
279 ClassElementImpl classC = ElementFactory.classElement2("C", []); | 289 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
280 classB.interfaces = <InterfaceType> [classA.type]; | 290 classB.interfaces = <InterfaceType> [classA.type]; |
281 classC.interfaces = <InterfaceType> [classB.type]; | 291 classC.interfaces = <InterfaceType> [classB.type]; |
282 Set<InterfaceType> superinterfacesOfA = InterfaceTypeImpl.computeSuperinterf
aceSet(classA.type); | 292 Set<InterfaceType> superinterfacesOfA = InterfaceTypeImpl.computeSuperinterf
aceSet(classA.type); |
283 JUnitTestCase.assertNotNull(superinterfacesOfA); | 293 EngineTestCase.assertSize3(1, superinterfacesOfA); |
284 JUnitTestCase.assertTrue(superinterfacesOfA.contains(ElementFactory.object.t
ype)); | 294 JUnitTestCase.assertTrue(superinterfacesOfA.contains(ElementFactory.object.t
ype)); |
285 JUnitTestCase.assertEquals(1, superinterfacesOfA.length); | |
286 Set<InterfaceType> superinterfacesOfB = InterfaceTypeImpl.computeSuperinterf
aceSet(classB.type); | 295 Set<InterfaceType> superinterfacesOfB = InterfaceTypeImpl.computeSuperinterf
aceSet(classB.type); |
287 JUnitTestCase.assertNotNull(superinterfacesOfB); | 296 EngineTestCase.assertSize3(2, superinterfacesOfB); |
288 JUnitTestCase.assertTrue(superinterfacesOfB.contains(ElementFactory.object.t
ype)); | 297 JUnitTestCase.assertTrue(superinterfacesOfB.contains(ElementFactory.object.t
ype)); |
289 JUnitTestCase.assertTrue(superinterfacesOfB.contains(classA.type)); | 298 JUnitTestCase.assertTrue(superinterfacesOfB.contains(classA.type)); |
290 JUnitTestCase.assertEquals(2, superinterfacesOfB.length); | |
291 Set<InterfaceType> superinterfacesOfC = InterfaceTypeImpl.computeSuperinterf
aceSet(classC.type); | 299 Set<InterfaceType> superinterfacesOfC = InterfaceTypeImpl.computeSuperinterf
aceSet(classC.type); |
292 JUnitTestCase.assertNotNull(superinterfacesOfC); | 300 EngineTestCase.assertSize3(3, superinterfacesOfC); |
293 JUnitTestCase.assertTrue(superinterfacesOfC.contains(ElementFactory.object.t
ype)); | 301 JUnitTestCase.assertTrue(superinterfacesOfC.contains(ElementFactory.object.t
ype)); |
294 JUnitTestCase.assertTrue(superinterfacesOfC.contains(classA.type)); | 302 JUnitTestCase.assertTrue(superinterfacesOfC.contains(classA.type)); |
295 JUnitTestCase.assertTrue(superinterfacesOfC.contains(classB.type)); | 303 JUnitTestCase.assertTrue(superinterfacesOfC.contains(classB.type)); |
296 JUnitTestCase.assertEquals(3, superinterfacesOfC.length); | |
297 } | 304 } |
298 void test_computeSuperinterfaceSet_singleSuperclassPath() { | 305 void test_computeSuperinterfaceSet_singleSuperclassPath() { |
299 ClassElement classA = ElementFactory.classElement2("A", []); | 306 ClassElement classA = ElementFactory.classElement2("A", []); |
300 ClassElement classB = ElementFactory.classElement("B", classA.type, []); | 307 ClassElement classB = ElementFactory.classElement("B", classA.type, []); |
301 ClassElement classC = ElementFactory.classElement("C", classB.type, []); | 308 ClassElement classC = ElementFactory.classElement("C", classB.type, []); |
302 Set<InterfaceType> superinterfacesOfA = InterfaceTypeImpl.computeSuperinterf
aceSet(classA.type); | 309 Set<InterfaceType> superinterfacesOfA = InterfaceTypeImpl.computeSuperinterf
aceSet(classA.type); |
303 JUnitTestCase.assertNotNull(superinterfacesOfA); | 310 EngineTestCase.assertSize3(1, superinterfacesOfA); |
304 JUnitTestCase.assertTrue(superinterfacesOfA.contains(ElementFactory.object.t
ype)); | 311 JUnitTestCase.assertTrue(superinterfacesOfA.contains(ElementFactory.object.t
ype)); |
305 JUnitTestCase.assertEquals(1, superinterfacesOfA.length); | |
306 Set<InterfaceType> superinterfacesOfB = InterfaceTypeImpl.computeSuperinterf
aceSet(classB.type); | 312 Set<InterfaceType> superinterfacesOfB = InterfaceTypeImpl.computeSuperinterf
aceSet(classB.type); |
307 JUnitTestCase.assertNotNull(superinterfacesOfB); | 313 EngineTestCase.assertSize3(2, superinterfacesOfB); |
308 JUnitTestCase.assertTrue(superinterfacesOfB.contains(ElementFactory.object.t
ype)); | 314 JUnitTestCase.assertTrue(superinterfacesOfB.contains(ElementFactory.object.t
ype)); |
309 JUnitTestCase.assertTrue(superinterfacesOfB.contains(classA.type)); | 315 JUnitTestCase.assertTrue(superinterfacesOfB.contains(classA.type)); |
310 JUnitTestCase.assertEquals(2, superinterfacesOfB.length); | |
311 Set<InterfaceType> superinterfacesOfC = InterfaceTypeImpl.computeSuperinterf
aceSet(classC.type); | 316 Set<InterfaceType> superinterfacesOfC = InterfaceTypeImpl.computeSuperinterf
aceSet(classC.type); |
312 JUnitTestCase.assertNotNull(superinterfacesOfC); | 317 EngineTestCase.assertSize3(3, superinterfacesOfC); |
313 JUnitTestCase.assertTrue(superinterfacesOfC.contains(ElementFactory.object.t
ype)); | 318 JUnitTestCase.assertTrue(superinterfacesOfC.contains(ElementFactory.object.t
ype)); |
314 JUnitTestCase.assertTrue(superinterfacesOfC.contains(classA.type)); | 319 JUnitTestCase.assertTrue(superinterfacesOfC.contains(classA.type)); |
315 JUnitTestCase.assertTrue(superinterfacesOfC.contains(classB.type)); | 320 JUnitTestCase.assertTrue(superinterfacesOfC.contains(classB.type)); |
316 JUnitTestCase.assertEquals(3, superinterfacesOfC.length); | |
317 } | 321 } |
318 void test_creation() { | 322 void test_creation() { |
319 JUnitTestCase.assertNotNull(new InterfaceTypeImpl.con1(ElementFactory.classE
lement2("A", []))); | 323 JUnitTestCase.assertNotNull(new InterfaceTypeImpl.con1(ElementFactory.classE
lement2("A", []))); |
320 } | 324 } |
321 void test_getElement() { | 325 void test_getElement() { |
322 ClassElementImpl typeElement = ElementFactory.classElement2("A", []); | 326 ClassElementImpl typeElement = ElementFactory.classElement2("A", []); |
323 InterfaceTypeImpl type = new InterfaceTypeImpl.con1(typeElement); | 327 InterfaceTypeImpl type = new InterfaceTypeImpl.con1(typeElement); |
324 JUnitTestCase.assertEquals(typeElement, type.element); | 328 JUnitTestCase.assertEquals(typeElement, type.element); |
325 } | 329 } |
326 void test_getGetter_implemented() { | 330 void test_getGetter_implemented() { |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 InterfaceType typeA = classA.type; | 542 InterfaceType typeA = classA.type; |
539 InterfaceType typeA2 = classA2.type; | 543 InterfaceType typeA2 = classA2.type; |
540 InterfaceType typeA3 = classA3.type; | 544 InterfaceType typeA3 = classA3.type; |
541 InterfaceType typeB = classB.type; | 545 InterfaceType typeB = classB.type; |
542 InterfaceType typeC = classC.type; | 546 InterfaceType typeC = classC.type; |
543 classB.interfaces = <InterfaceType> [typeA, typeA2]; | 547 classB.interfaces = <InterfaceType> [typeA, typeA2]; |
544 classC.interfaces = <InterfaceType> [typeA, typeA3]; | 548 classC.interfaces = <InterfaceType> [typeA, typeA3]; |
545 JUnitTestCase.assertEquals(typeA, typeB.getLeastUpperBound(typeC)); | 549 JUnitTestCase.assertEquals(typeA, typeB.getLeastUpperBound(typeC)); |
546 JUnitTestCase.assertEquals(typeA, typeC.getLeastUpperBound(typeB)); | 550 JUnitTestCase.assertEquals(typeA, typeC.getLeastUpperBound(typeB)); |
547 } | 551 } |
| 552 void test_getLeastUpperBound_twoComparables() { |
| 553 InterfaceType string = _typeProvider.stringType; |
| 554 InterfaceType num = _typeProvider.numType; |
| 555 JUnitTestCase.assertEquals(_typeProvider.objectType, string.getLeastUpperBou
nd(num)); |
| 556 } |
548 void test_getLeastUpperBound_typeParameters_different() { | 557 void test_getLeastUpperBound_typeParameters_different() { |
549 InterfaceType listType2 = _typeProvider.listType; | 558 InterfaceType listType2 = _typeProvider.listType; |
550 InterfaceType intType2 = _typeProvider.intType; | 559 InterfaceType intType2 = _typeProvider.intType; |
551 InterfaceType doubleType2 = _typeProvider.doubleType; | 560 InterfaceType doubleType2 = _typeProvider.doubleType; |
552 InterfaceType listOfIntType = listType2.substitute5(<Type2> [intType2]); | 561 InterfaceType listOfIntType = listType2.substitute5(<Type2> [intType2]); |
553 InterfaceType listOfDoubleType = listType2.substitute5(<Type2> [doubleType2]
); | 562 InterfaceType listOfDoubleType = listType2.substitute5(<Type2> [doubleType2]
); |
554 JUnitTestCase.assertEquals(listType2.substitute5(<Type2> [_typeProvider.numT
ype]), listOfIntType.getLeastUpperBound(listOfDoubleType)); | 563 JUnitTestCase.assertEquals(listType2.substitute5(<Type2> [_typeProvider.dyna
micType]), listOfIntType.getLeastUpperBound(listOfDoubleType)); |
555 } | 564 } |
556 void test_getLeastUpperBound_typeParameters_same() { | 565 void test_getLeastUpperBound_typeParameters_same() { |
557 InterfaceType listType2 = _typeProvider.listType; | 566 InterfaceType listType2 = _typeProvider.listType; |
558 InterfaceType intType2 = _typeProvider.intType; | 567 InterfaceType intType2 = _typeProvider.intType; |
559 InterfaceType listOfIntType = listType2.substitute5(<Type2> [intType2]); | 568 InterfaceType listOfIntType = listType2.substitute5(<Type2> [intType2]); |
560 JUnitTestCase.assertEquals(listOfIntType, listOfIntType.getLeastUpperBound(l
istOfIntType)); | 569 JUnitTestCase.assertEquals(listOfIntType, listOfIntType.getLeastUpperBound(l
istOfIntType)); |
561 } | 570 } |
562 void test_getMethod_implemented() { | 571 void test_getMethod_implemented() { |
563 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 572 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
564 String methodName = "m"; | 573 String methodName = "m"; |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 ClassElement classB = ElementFactory.classElement("B", classA.type, []); | 735 ClassElement classB = ElementFactory.classElement("B", classA.type, []); |
727 InterfaceType typeA = classA.type; | 736 InterfaceType typeA = classA.type; |
728 InterfaceType typeB = classB.type; | 737 InterfaceType typeB = classB.type; |
729 JUnitTestCase.assertTrue(typeB.isMoreSpecificThan(typeA)); | 738 JUnitTestCase.assertTrue(typeB.isMoreSpecificThan(typeA)); |
730 JUnitTestCase.assertFalse(typeA.isMoreSpecificThan(typeB)); | 739 JUnitTestCase.assertFalse(typeA.isMoreSpecificThan(typeB)); |
731 } | 740 } |
732 void test_isMoreSpecificThan_dynamic() { | 741 void test_isMoreSpecificThan_dynamic() { |
733 InterfaceType type2 = ElementFactory.classElement2("A", []).type; | 742 InterfaceType type2 = ElementFactory.classElement2("A", []).type; |
734 JUnitTestCase.assertTrue(type2.isMoreSpecificThan(DynamicTypeImpl.instance))
; | 743 JUnitTestCase.assertTrue(type2.isMoreSpecificThan(DynamicTypeImpl.instance))
; |
735 } | 744 } |
736 void test_isMoreSpecificThan_indirectSupertype() { | 745 void test_isMoreSpecificThan_self() { |
| 746 InterfaceType type2 = ElementFactory.classElement2("A", []).type; |
| 747 JUnitTestCase.assertTrue(type2.isMoreSpecificThan(type2)); |
| 748 } |
| 749 void test_isMoreSpecificThan_transitive_interface() { |
| 750 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 751 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 752 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
| 753 classC.interfaces = <InterfaceType> [classB.type]; |
| 754 InterfaceType typeA = classA.type; |
| 755 InterfaceType typeC = classC.type; |
| 756 JUnitTestCase.assertTrue(typeC.isMoreSpecificThan(typeA)); |
| 757 } |
| 758 void test_isMoreSpecificThan_transitive_mixin() { |
| 759 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 760 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 761 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
| 762 classC.mixins = <InterfaceType> [classB.type]; |
| 763 InterfaceType typeA = classA.type; |
| 764 InterfaceType typeC = classC.type; |
| 765 JUnitTestCase.assertTrue(typeC.isMoreSpecificThan(typeA)); |
| 766 } |
| 767 void test_isMoreSpecificThan_transitive_recursive() { |
| 768 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 769 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 770 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
| 771 InterfaceType typeA = classA.type; |
| 772 InterfaceType typeC = classC.type; |
| 773 classA.supertype = classB.type; |
| 774 JUnitTestCase.assertFalse(typeA.isMoreSpecificThan(typeC)); |
| 775 } |
| 776 void test_isMoreSpecificThan_transitive_superclass() { |
737 ClassElement classA = ElementFactory.classElement2("A", []); | 777 ClassElement classA = ElementFactory.classElement2("A", []); |
738 ClassElement classB = ElementFactory.classElement("B", classA.type, []); | 778 ClassElement classB = ElementFactory.classElement("B", classA.type, []); |
739 ClassElement classC = ElementFactory.classElement("C", classB.type, []); | 779 ClassElement classC = ElementFactory.classElement("C", classB.type, []); |
740 InterfaceType typeA = classA.type; | 780 InterfaceType typeA = classA.type; |
741 InterfaceType typeC = classC.type; | 781 InterfaceType typeC = classC.type; |
742 JUnitTestCase.assertTrue(typeC.isMoreSpecificThan(typeA)); | 782 JUnitTestCase.assertTrue(typeC.isMoreSpecificThan(typeA)); |
743 } | 783 } |
744 void test_isMoreSpecificThan_self() { | |
745 InterfaceType type2 = ElementFactory.classElement2("A", []).type; | |
746 JUnitTestCase.assertTrue(type2.isMoreSpecificThan(type2)); | |
747 } | |
748 void test_isSubtypeOf_directSubtype() { | 784 void test_isSubtypeOf_directSubtype() { |
749 ClassElement classA = ElementFactory.classElement2("A", []); | 785 ClassElement classA = ElementFactory.classElement2("A", []); |
750 ClassElement classB = ElementFactory.classElement("B", classA.type, []); | 786 ClassElement classB = ElementFactory.classElement("B", classA.type, []); |
751 InterfaceType typeA = classA.type; | 787 InterfaceType typeA = classA.type; |
752 InterfaceType typeB = classB.type; | 788 InterfaceType typeB = classB.type; |
753 JUnitTestCase.assertTrue(typeB.isSubtypeOf(typeA)); | 789 JUnitTestCase.assertTrue(typeB.isSubtypeOf(typeA)); |
754 JUnitTestCase.assertFalse(typeA.isSubtypeOf(typeB)); | 790 JUnitTestCase.assertFalse(typeA.isSubtypeOf(typeB)); |
755 } | 791 } |
756 void test_isSubtypeOf_dynamic() { | 792 void test_isSubtypeOf_dynamic() { |
757 ClassElement classA = ElementFactory.classElement2("A", []); | 793 ClassElement classA = ElementFactory.classElement2("A", []); |
758 InterfaceType typeA = classA.type; | 794 InterfaceType typeA = classA.type; |
759 Type2 dynamicType = DynamicTypeImpl.instance; | 795 Type2 dynamicType = DynamicTypeImpl.instance; |
760 JUnitTestCase.assertFalse(dynamicType.isSubtypeOf(typeA)); | 796 JUnitTestCase.assertFalse(dynamicType.isSubtypeOf(typeA)); |
761 JUnitTestCase.assertTrue(typeA.isSubtypeOf(dynamicType)); | 797 JUnitTestCase.assertTrue(typeA.isSubtypeOf(dynamicType)); |
762 } | 798 } |
763 void test_isSubtypeOf_indirectSubtype() { | |
764 ClassElement classA = ElementFactory.classElement2("A", []); | |
765 ClassElement classB = ElementFactory.classElement("B", classA.type, []); | |
766 ClassElement classC = ElementFactory.classElement("C", classB.type, []); | |
767 InterfaceType typeA = classA.type; | |
768 InterfaceType typeC = classC.type; | |
769 JUnitTestCase.assertTrue(typeC.isSubtypeOf(typeA)); | |
770 JUnitTestCase.assertFalse(typeA.isSubtypeOf(typeC)); | |
771 } | |
772 void test_isSubtypeOf_interface() { | 799 void test_isSubtypeOf_interface() { |
773 ClassElement classA = ElementFactory.classElement2("A", []); | 800 ClassElement classA = ElementFactory.classElement2("A", []); |
774 ClassElement classB = ElementFactory.classElement("B", classA.type, []); | 801 ClassElement classB = ElementFactory.classElement("B", classA.type, []); |
775 ClassElementImpl classC = ElementFactory.classElement2("C", []); | 802 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
776 InterfaceType typeObject = classA.supertype; | 803 InterfaceType typeObject = classA.supertype; |
777 InterfaceType typeA = classA.type; | 804 InterfaceType typeA = classA.type; |
778 InterfaceType typeB = classB.type; | 805 InterfaceType typeB = classB.type; |
779 InterfaceType typeC = classC.type; | 806 InterfaceType typeC = classC.type; |
780 classC.interfaces = <InterfaceType> [typeB]; | 807 classC.interfaces = <InterfaceType> [typeB]; |
781 JUnitTestCase.assertTrue(typeC.isSubtypeOf(typeB)); | 808 JUnitTestCase.assertTrue(typeC.isSubtypeOf(typeB)); |
782 JUnitTestCase.assertTrue(typeC.isSubtypeOf(typeObject)); | 809 JUnitTestCase.assertTrue(typeC.isSubtypeOf(typeObject)); |
783 JUnitTestCase.assertTrue(typeC.isSubtypeOf(typeA)); | 810 JUnitTestCase.assertTrue(typeC.isSubtypeOf(typeA)); |
784 JUnitTestCase.assertFalse(typeA.isSubtypeOf(typeC)); | 811 JUnitTestCase.assertFalse(typeA.isSubtypeOf(typeC)); |
785 } | 812 } |
786 void test_isSubtypeOf_mixins() { | 813 void test_isSubtypeOf_mixins() { |
787 ClassElement classA = ElementFactory.classElement2("A", []); | 814 ClassElement classA = ElementFactory.classElement2("A", []); |
788 ClassElement classB = ElementFactory.classElement("B", classA.type, []); | 815 ClassElement classB = ElementFactory.classElement("B", classA.type, []); |
789 ClassElementImpl classC = ElementFactory.classElement2("C", []); | 816 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
790 InterfaceType typeObject = classA.supertype; | 817 InterfaceType typeObject = classA.supertype; |
791 InterfaceType typeA = classA.type; | 818 InterfaceType typeA = classA.type; |
792 InterfaceType typeB = classB.type; | 819 InterfaceType typeB = classB.type; |
793 InterfaceType typeC = classC.type; | 820 InterfaceType typeC = classC.type; |
794 classC.mixins = <InterfaceType> [typeB]; | 821 classC.mixins = <InterfaceType> [typeB]; |
795 JUnitTestCase.assertTrue(typeC.isSubtypeOf(typeB)); | 822 JUnitTestCase.assertTrue(typeC.isSubtypeOf(typeB)); |
796 JUnitTestCase.assertTrue(typeC.isSubtypeOf(typeObject)); | 823 JUnitTestCase.assertTrue(typeC.isSubtypeOf(typeObject)); |
797 JUnitTestCase.assertFalse(typeC.isSubtypeOf(typeA)); | 824 JUnitTestCase.assertTrue(typeC.isSubtypeOf(typeA)); |
798 JUnitTestCase.assertFalse(typeA.isSubtypeOf(typeC)); | 825 JUnitTestCase.assertFalse(typeA.isSubtypeOf(typeC)); |
799 } | 826 } |
800 void test_isSubtypeOf_object() { | 827 void test_isSubtypeOf_object() { |
801 ClassElement classA = ElementFactory.classElement2("A", []); | 828 ClassElement classA = ElementFactory.classElement2("A", []); |
802 InterfaceType typeA = classA.type; | 829 InterfaceType typeA = classA.type; |
803 InterfaceType typeObject = classA.supertype; | 830 InterfaceType typeObject = classA.supertype; |
804 JUnitTestCase.assertTrue(typeA.isSubtypeOf(typeObject)); | 831 JUnitTestCase.assertTrue(typeA.isSubtypeOf(typeObject)); |
805 JUnitTestCase.assertFalse(typeObject.isSubtypeOf(typeA)); | 832 JUnitTestCase.assertFalse(typeObject.isSubtypeOf(typeA)); |
806 } | 833 } |
807 void test_isSubtypeOf_self() { | 834 void test_isSubtypeOf_self() { |
808 ClassElement classA = ElementFactory.classElement2("A", []); | 835 ClassElement classA = ElementFactory.classElement2("A", []); |
809 InterfaceType typeA = classA.type; | 836 InterfaceType typeA = classA.type; |
810 JUnitTestCase.assertTrue(typeA.isSubtypeOf(typeA)); | 837 JUnitTestCase.assertTrue(typeA.isSubtypeOf(typeA)); |
811 } | 838 } |
| 839 void test_isSubtypeOf_transitive_recursive() { |
| 840 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 841 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 842 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
| 843 InterfaceType typeA = classA.type; |
| 844 InterfaceType typeC = classC.type; |
| 845 classA.supertype = classB.type; |
| 846 JUnitTestCase.assertFalse(typeA.isSubtypeOf(typeC)); |
| 847 } |
| 848 void test_isSubtypeOf_transitive_superclass() { |
| 849 ClassElement classA = ElementFactory.classElement2("A", []); |
| 850 ClassElement classB = ElementFactory.classElement("B", classA.type, []); |
| 851 ClassElement classC = ElementFactory.classElement("C", classB.type, []); |
| 852 InterfaceType typeA = classA.type; |
| 853 InterfaceType typeC = classC.type; |
| 854 JUnitTestCase.assertTrue(typeC.isSubtypeOf(typeA)); |
| 855 JUnitTestCase.assertFalse(typeA.isSubtypeOf(typeC)); |
| 856 } |
812 void test_isSubtypeOf_typeArguments() { | 857 void test_isSubtypeOf_typeArguments() { |
813 ClassElement classA = ElementFactory.classElement2("A", ["E"]); | 858 ClassElement classA = ElementFactory.classElement2("A", ["E"]); |
814 ClassElement classI = ElementFactory.classElement2("I", []); | 859 ClassElement classI = ElementFactory.classElement2("I", []); |
815 ClassElement classJ = ElementFactory.classElement("J", classI.type, []); | 860 ClassElement classJ = ElementFactory.classElement("J", classI.type, []); |
816 ClassElement classK = ElementFactory.classElement2("K", []); | 861 ClassElement classK = ElementFactory.classElement2("K", []); |
817 InterfaceType typeA = classA.type; | 862 InterfaceType typeA = classA.type; |
818 InterfaceTypeImpl typeAI = new InterfaceTypeImpl.con1(classA); | 863 InterfaceTypeImpl typeAI = new InterfaceTypeImpl.con1(classA); |
819 InterfaceTypeImpl typeAJ = new InterfaceTypeImpl.con1(classA); | 864 InterfaceTypeImpl typeAJ = new InterfaceTypeImpl.con1(classA); |
820 InterfaceTypeImpl typeAK = new InterfaceTypeImpl.con1(classA); | 865 InterfaceTypeImpl typeAK = new InterfaceTypeImpl.con1(classA); |
821 typeAI.typeArguments = <Type2> [classI.type]; | 866 typeAI.typeArguments = <Type2> [classI.type]; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
873 ClassElement classA = ElementFactory.classElement2("A", []); | 918 ClassElement classA = ElementFactory.classElement2("A", []); |
874 ClassElement classB = ElementFactory.classElement("B", classA.type, []); | 919 ClassElement classB = ElementFactory.classElement("B", classA.type, []); |
875 ClassElementImpl classC = ElementFactory.classElement2("C", []); | 920 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
876 InterfaceType typeObject = classA.supertype; | 921 InterfaceType typeObject = classA.supertype; |
877 InterfaceType typeA = classA.type; | 922 InterfaceType typeA = classA.type; |
878 InterfaceType typeB = classB.type; | 923 InterfaceType typeB = classB.type; |
879 InterfaceType typeC = classC.type; | 924 InterfaceType typeC = classC.type; |
880 classC.mixins = <InterfaceType> [typeB]; | 925 classC.mixins = <InterfaceType> [typeB]; |
881 JUnitTestCase.assertTrue(typeB.isSupertypeOf(typeC)); | 926 JUnitTestCase.assertTrue(typeB.isSupertypeOf(typeC)); |
882 JUnitTestCase.assertTrue(typeObject.isSupertypeOf(typeC)); | 927 JUnitTestCase.assertTrue(typeObject.isSupertypeOf(typeC)); |
883 JUnitTestCase.assertFalse(typeA.isSupertypeOf(typeC)); | 928 JUnitTestCase.assertTrue(typeA.isSupertypeOf(typeC)); |
884 JUnitTestCase.assertFalse(typeC.isSupertypeOf(typeA)); | 929 JUnitTestCase.assertFalse(typeC.isSupertypeOf(typeA)); |
885 } | 930 } |
886 void test_isSupertypeOf_object() { | 931 void test_isSupertypeOf_object() { |
887 ClassElement classA = ElementFactory.classElement2("A", []); | 932 ClassElement classA = ElementFactory.classElement2("A", []); |
888 InterfaceType typeA = classA.type; | 933 InterfaceType typeA = classA.type; |
889 InterfaceType typeObject = classA.supertype; | 934 InterfaceType typeObject = classA.supertype; |
890 JUnitTestCase.assertFalse(typeA.isSupertypeOf(typeObject)); | 935 JUnitTestCase.assertFalse(typeA.isSupertypeOf(typeObject)); |
891 JUnitTestCase.assertTrue(typeObject.isSupertypeOf(typeA)); | 936 JUnitTestCase.assertTrue(typeObject.isSupertypeOf(typeA)); |
892 } | 937 } |
893 void test_isSupertypeOf_self() { | 938 void test_isSupertypeOf_self() { |
(...skipping 17 matching lines...) Expand all Loading... |
911 String getterName = "g"; | 956 String getterName = "g"; |
912 PropertyAccessorElement getterG = ElementFactory.getterElement(getterName, f
alse, null); | 957 PropertyAccessorElement getterG = ElementFactory.getterElement(getterName, f
alse, null); |
913 classA.accessors = <PropertyAccessorElement> [getterG]; | 958 classA.accessors = <PropertyAccessorElement> [getterG]; |
914 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 959 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
915 InterfaceType typeB = classB.type; | 960 InterfaceType typeB = classB.type; |
916 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); | 961 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); |
917 CompilationUnitElement unit = library2.definingCompilationUnit; | 962 CompilationUnitElement unit = library2.definingCompilationUnit; |
918 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA, class
B]; | 963 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA, class
B]; |
919 JUnitTestCase.assertSame(getterG, typeB.lookUpGetter(getterName, library2)); | 964 JUnitTestCase.assertSame(getterG, typeB.lookUpGetter(getterName, library2)); |
920 } | 965 } |
| 966 void test_lookUpGetter_recursive() { |
| 967 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 968 InterfaceType typeA = classA.type; |
| 969 ClassElementImpl classB = ElementFactory.classElement("B", typeA, []); |
| 970 classA.supertype = classB.type; |
| 971 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); |
| 972 CompilationUnitElement unit = library2.definingCompilationUnit; |
| 973 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA, class
B]; |
| 974 JUnitTestCase.assertNull(typeA.lookUpGetter("g", library2)); |
| 975 } |
921 void test_lookUpGetter_unimplemented() { | 976 void test_lookUpGetter_unimplemented() { |
922 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 977 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
923 InterfaceType typeA = classA.type; | 978 InterfaceType typeA = classA.type; |
924 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); | 979 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); |
925 CompilationUnitElement unit = library2.definingCompilationUnit; | 980 CompilationUnitElement unit = library2.definingCompilationUnit; |
926 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA]; | 981 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA]; |
927 JUnitTestCase.assertNull(typeA.lookUpGetter("g", library2)); | 982 JUnitTestCase.assertNull(typeA.lookUpGetter("g", library2)); |
928 } | 983 } |
929 void test_lookUpMethod_implemented() { | 984 void test_lookUpMethod_implemented() { |
930 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 985 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
967 InterfaceTypeImpl typeBI = new InterfaceTypeImpl.con1(classB); | 1022 InterfaceTypeImpl typeBI = new InterfaceTypeImpl.con1(classB); |
968 typeBI.typeArguments = <Type2> [typeI]; | 1023 typeBI.typeArguments = <Type2> [typeI]; |
969 MethodElement method = typeBI.lookUpMethod(methodName, library2); | 1024 MethodElement method = typeBI.lookUpMethod(methodName, library2); |
970 JUnitTestCase.assertNotNull(method); | 1025 JUnitTestCase.assertNotNull(method); |
971 FunctionType methodType = method.type; | 1026 FunctionType methodType = method.type; |
972 JUnitTestCase.assertSame(typeI, methodType.returnType); | 1027 JUnitTestCase.assertSame(typeI, methodType.returnType); |
973 List<Type2> parameterTypes = methodType.normalParameterTypes; | 1028 List<Type2> parameterTypes = methodType.normalParameterTypes; |
974 EngineTestCase.assertLength(1, parameterTypes); | 1029 EngineTestCase.assertLength(1, parameterTypes); |
975 JUnitTestCase.assertSame(typeI, parameterTypes[0]); | 1030 JUnitTestCase.assertSame(typeI, parameterTypes[0]); |
976 } | 1031 } |
| 1032 void test_lookUpMethod_recursive() { |
| 1033 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1034 InterfaceType typeA = classA.type; |
| 1035 ClassElementImpl classB = ElementFactory.classElement("B", typeA, []); |
| 1036 classA.supertype = classB.type; |
| 1037 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); |
| 1038 CompilationUnitElement unit = library2.definingCompilationUnit; |
| 1039 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA, class
B]; |
| 1040 JUnitTestCase.assertNull(typeA.lookUpMethod("m", library2)); |
| 1041 } |
977 void test_lookUpMethod_unimplemented() { | 1042 void test_lookUpMethod_unimplemented() { |
978 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1043 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
979 InterfaceType typeA = classA.type; | 1044 InterfaceType typeA = classA.type; |
980 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); | 1045 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); |
981 CompilationUnitElement unit = library2.definingCompilationUnit; | 1046 CompilationUnitElement unit = library2.definingCompilationUnit; |
982 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA]; | 1047 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA]; |
983 JUnitTestCase.assertNull(typeA.lookUpMethod("m", library2)); | 1048 JUnitTestCase.assertNull(typeA.lookUpMethod("m", library2)); |
984 } | 1049 } |
985 void test_lookUpSetter_implemented() { | 1050 void test_lookUpSetter_implemented() { |
986 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1051 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
(...skipping 11 matching lines...) Expand all Loading... |
998 String setterName = "g"; | 1063 String setterName = "g"; |
999 PropertyAccessorElement setterS = ElementFactory.setterElement(setterName, f
alse, null); | 1064 PropertyAccessorElement setterS = ElementFactory.setterElement(setterName, f
alse, null); |
1000 classA.accessors = <PropertyAccessorElement> [setterS]; | 1065 classA.accessors = <PropertyAccessorElement> [setterS]; |
1001 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 1066 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
1002 InterfaceType typeB = classB.type; | 1067 InterfaceType typeB = classB.type; |
1003 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); | 1068 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); |
1004 CompilationUnitElement unit = library2.definingCompilationUnit; | 1069 CompilationUnitElement unit = library2.definingCompilationUnit; |
1005 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA, class
B]; | 1070 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA, class
B]; |
1006 JUnitTestCase.assertSame(setterS, typeB.lookUpSetter(setterName, library2)); | 1071 JUnitTestCase.assertSame(setterS, typeB.lookUpSetter(setterName, library2)); |
1007 } | 1072 } |
| 1073 void test_lookUpSetter_recursive() { |
| 1074 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1075 InterfaceType typeA = classA.type; |
| 1076 ClassElementImpl classB = ElementFactory.classElement("B", typeA, []); |
| 1077 classA.supertype = classB.type; |
| 1078 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); |
| 1079 CompilationUnitElement unit = library2.definingCompilationUnit; |
| 1080 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA, class
B]; |
| 1081 JUnitTestCase.assertNull(typeA.lookUpSetter("s", library2)); |
| 1082 } |
1008 void test_lookUpSetter_unimplemented() { | 1083 void test_lookUpSetter_unimplemented() { |
1009 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1084 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
1010 InterfaceType typeA = classA.type; | 1085 InterfaceType typeA = classA.type; |
1011 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); | 1086 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); |
1012 CompilationUnitElement unit = library2.definingCompilationUnit; | 1087 CompilationUnitElement unit = library2.definingCompilationUnit; |
1013 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA]; | 1088 ((unit as CompilationUnitElementImpl)).types = <ClassElement> [classA]; |
1014 JUnitTestCase.assertNull(typeA.lookUpSetter("s", library2)); | 1089 JUnitTestCase.assertNull(typeA.lookUpSetter("s", library2)); |
1015 } | 1090 } |
1016 void test_setTypeArguments() { | 1091 void test_setTypeArguments() { |
1017 InterfaceTypeImpl type2 = ElementFactory.classElement2("A", []).type as Inte
rfaceTypeImpl; | 1092 InterfaceTypeImpl type2 = ElementFactory.classElement2("A", []).type as Inte
rfaceTypeImpl; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1053 runJUnitTest(__test, __test.test_computeLongestInheritancePathToObject_m
ultipleInterfacePaths); | 1128 runJUnitTest(__test, __test.test_computeLongestInheritancePathToObject_m
ultipleInterfacePaths); |
1054 }); | 1129 }); |
1055 _ut.test('test_computeLongestInheritancePathToObject_multipleSuperclassPat
hs', () { | 1130 _ut.test('test_computeLongestInheritancePathToObject_multipleSuperclassPat
hs', () { |
1056 final __test = new InterfaceTypeImplTest(); | 1131 final __test = new InterfaceTypeImplTest(); |
1057 runJUnitTest(__test, __test.test_computeLongestInheritancePathToObject_m
ultipleSuperclassPaths); | 1132 runJUnitTest(__test, __test.test_computeLongestInheritancePathToObject_m
ultipleSuperclassPaths); |
1058 }); | 1133 }); |
1059 _ut.test('test_computeLongestInheritancePathToObject_object', () { | 1134 _ut.test('test_computeLongestInheritancePathToObject_object', () { |
1060 final __test = new InterfaceTypeImplTest(); | 1135 final __test = new InterfaceTypeImplTest(); |
1061 runJUnitTest(__test, __test.test_computeLongestInheritancePathToObject_o
bject); | 1136 runJUnitTest(__test, __test.test_computeLongestInheritancePathToObject_o
bject); |
1062 }); | 1137 }); |
| 1138 _ut.test('test_computeLongestInheritancePathToObject_recursion', () { |
| 1139 final __test = new InterfaceTypeImplTest(); |
| 1140 runJUnitTest(__test, __test.test_computeLongestInheritancePathToObject_r
ecursion); |
| 1141 }); |
1063 _ut.test('test_computeLongestInheritancePathToObject_singleInterfacePath',
() { | 1142 _ut.test('test_computeLongestInheritancePathToObject_singleInterfacePath',
() { |
1064 final __test = new InterfaceTypeImplTest(); | 1143 final __test = new InterfaceTypeImplTest(); |
1065 runJUnitTest(__test, __test.test_computeLongestInheritancePathToObject_s
ingleInterfacePath); | 1144 runJUnitTest(__test, __test.test_computeLongestInheritancePathToObject_s
ingleInterfacePath); |
1066 }); | 1145 }); |
1067 _ut.test('test_computeLongestInheritancePathToObject_singleSuperclassPath'
, () { | 1146 _ut.test('test_computeLongestInheritancePathToObject_singleSuperclassPath'
, () { |
1068 final __test = new InterfaceTypeImplTest(); | 1147 final __test = new InterfaceTypeImplTest(); |
1069 runJUnitTest(__test, __test.test_computeLongestInheritancePathToObject_s
ingleSuperclassPath); | 1148 runJUnitTest(__test, __test.test_computeLongestInheritancePathToObject_s
ingleSuperclassPath); |
1070 }); | 1149 }); |
1071 _ut.test('test_computeSuperinterfaceSet_multipleInterfacePaths', () { | 1150 _ut.test('test_computeSuperinterfaceSet_multipleInterfacePaths', () { |
1072 final __test = new InterfaceTypeImplTest(); | 1151 final __test = new InterfaceTypeImplTest(); |
1073 runJUnitTest(__test, __test.test_computeSuperinterfaceSet_multipleInterf
acePaths); | 1152 runJUnitTest(__test, __test.test_computeSuperinterfaceSet_multipleInterf
acePaths); |
1074 }); | 1153 }); |
1075 _ut.test('test_computeSuperinterfaceSet_multipleSuperclassPaths', () { | 1154 _ut.test('test_computeSuperinterfaceSet_multipleSuperclassPaths', () { |
1076 final __test = new InterfaceTypeImplTest(); | 1155 final __test = new InterfaceTypeImplTest(); |
1077 runJUnitTest(__test, __test.test_computeSuperinterfaceSet_multipleSuperc
lassPaths); | 1156 runJUnitTest(__test, __test.test_computeSuperinterfaceSet_multipleSuperc
lassPaths); |
1078 }); | 1157 }); |
| 1158 _ut.test('test_computeSuperinterfaceSet_recursion', () { |
| 1159 final __test = new InterfaceTypeImplTest(); |
| 1160 runJUnitTest(__test, __test.test_computeSuperinterfaceSet_recursion); |
| 1161 }); |
1079 _ut.test('test_computeSuperinterfaceSet_singleInterfacePath', () { | 1162 _ut.test('test_computeSuperinterfaceSet_singleInterfacePath', () { |
1080 final __test = new InterfaceTypeImplTest(); | 1163 final __test = new InterfaceTypeImplTest(); |
1081 runJUnitTest(__test, __test.test_computeSuperinterfaceSet_singleInterfac
ePath); | 1164 runJUnitTest(__test, __test.test_computeSuperinterfaceSet_singleInterfac
ePath); |
1082 }); | 1165 }); |
1083 _ut.test('test_computeSuperinterfaceSet_singleSuperclassPath', () { | 1166 _ut.test('test_computeSuperinterfaceSet_singleSuperclassPath', () { |
1084 final __test = new InterfaceTypeImplTest(); | 1167 final __test = new InterfaceTypeImplTest(); |
1085 runJUnitTest(__test, __test.test_computeSuperinterfaceSet_singleSupercla
ssPath); | 1168 runJUnitTest(__test, __test.test_computeSuperinterfaceSet_singleSupercla
ssPath); |
1086 }); | 1169 }); |
1087 _ut.test('test_creation', () { | 1170 _ut.test('test_creation', () { |
1088 final __test = new InterfaceTypeImplTest(); | 1171 final __test = new InterfaceTypeImplTest(); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1165 runJUnitTest(__test, __test.test_getLeastUpperBound_sharedSuperinterface
2); | 1248 runJUnitTest(__test, __test.test_getLeastUpperBound_sharedSuperinterface
2); |
1166 }); | 1249 }); |
1167 _ut.test('test_getLeastUpperBound_sharedSuperinterface3', () { | 1250 _ut.test('test_getLeastUpperBound_sharedSuperinterface3', () { |
1168 final __test = new InterfaceTypeImplTest(); | 1251 final __test = new InterfaceTypeImplTest(); |
1169 runJUnitTest(__test, __test.test_getLeastUpperBound_sharedSuperinterface
3); | 1252 runJUnitTest(__test, __test.test_getLeastUpperBound_sharedSuperinterface
3); |
1170 }); | 1253 }); |
1171 _ut.test('test_getLeastUpperBound_sharedSuperinterface4', () { | 1254 _ut.test('test_getLeastUpperBound_sharedSuperinterface4', () { |
1172 final __test = new InterfaceTypeImplTest(); | 1255 final __test = new InterfaceTypeImplTest(); |
1173 runJUnitTest(__test, __test.test_getLeastUpperBound_sharedSuperinterface
4); | 1256 runJUnitTest(__test, __test.test_getLeastUpperBound_sharedSuperinterface
4); |
1174 }); | 1257 }); |
| 1258 _ut.test('test_getLeastUpperBound_twoComparables', () { |
| 1259 final __test = new InterfaceTypeImplTest(); |
| 1260 runJUnitTest(__test, __test.test_getLeastUpperBound_twoComparables); |
| 1261 }); |
1175 _ut.test('test_getLeastUpperBound_typeParameters_different', () { | 1262 _ut.test('test_getLeastUpperBound_typeParameters_different', () { |
1176 final __test = new InterfaceTypeImplTest(); | 1263 final __test = new InterfaceTypeImplTest(); |
1177 runJUnitTest(__test, __test.test_getLeastUpperBound_typeParameters_diffe
rent); | 1264 runJUnitTest(__test, __test.test_getLeastUpperBound_typeParameters_diffe
rent); |
1178 }); | 1265 }); |
1179 _ut.test('test_getLeastUpperBound_typeParameters_same', () { | 1266 _ut.test('test_getLeastUpperBound_typeParameters_same', () { |
1180 final __test = new InterfaceTypeImplTest(); | 1267 final __test = new InterfaceTypeImplTest(); |
1181 runJUnitTest(__test, __test.test_getLeastUpperBound_typeParameters_same)
; | 1268 runJUnitTest(__test, __test.test_getLeastUpperBound_typeParameters_same)
; |
1182 }); | 1269 }); |
1183 _ut.test('test_getMethod_implemented', () { | 1270 _ut.test('test_getMethod_implemented', () { |
1184 final __test = new InterfaceTypeImplTest(); | 1271 final __test = new InterfaceTypeImplTest(); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1249 runJUnitTest(__test, __test.test_isMoreSpecificThan_covariance); | 1336 runJUnitTest(__test, __test.test_isMoreSpecificThan_covariance); |
1250 }); | 1337 }); |
1251 _ut.test('test_isMoreSpecificThan_directSupertype', () { | 1338 _ut.test('test_isMoreSpecificThan_directSupertype', () { |
1252 final __test = new InterfaceTypeImplTest(); | 1339 final __test = new InterfaceTypeImplTest(); |
1253 runJUnitTest(__test, __test.test_isMoreSpecificThan_directSupertype); | 1340 runJUnitTest(__test, __test.test_isMoreSpecificThan_directSupertype); |
1254 }); | 1341 }); |
1255 _ut.test('test_isMoreSpecificThan_dynamic', () { | 1342 _ut.test('test_isMoreSpecificThan_dynamic', () { |
1256 final __test = new InterfaceTypeImplTest(); | 1343 final __test = new InterfaceTypeImplTest(); |
1257 runJUnitTest(__test, __test.test_isMoreSpecificThan_dynamic); | 1344 runJUnitTest(__test, __test.test_isMoreSpecificThan_dynamic); |
1258 }); | 1345 }); |
1259 _ut.test('test_isMoreSpecificThan_indirectSupertype', () { | |
1260 final __test = new InterfaceTypeImplTest(); | |
1261 runJUnitTest(__test, __test.test_isMoreSpecificThan_indirectSupertype); | |
1262 }); | |
1263 _ut.test('test_isMoreSpecificThan_self', () { | 1346 _ut.test('test_isMoreSpecificThan_self', () { |
1264 final __test = new InterfaceTypeImplTest(); | 1347 final __test = new InterfaceTypeImplTest(); |
1265 runJUnitTest(__test, __test.test_isMoreSpecificThan_self); | 1348 runJUnitTest(__test, __test.test_isMoreSpecificThan_self); |
1266 }); | 1349 }); |
| 1350 _ut.test('test_isMoreSpecificThan_transitive_interface', () { |
| 1351 final __test = new InterfaceTypeImplTest(); |
| 1352 runJUnitTest(__test, __test.test_isMoreSpecificThan_transitive_interface
); |
| 1353 }); |
| 1354 _ut.test('test_isMoreSpecificThan_transitive_mixin', () { |
| 1355 final __test = new InterfaceTypeImplTest(); |
| 1356 runJUnitTest(__test, __test.test_isMoreSpecificThan_transitive_mixin); |
| 1357 }); |
| 1358 _ut.test('test_isMoreSpecificThan_transitive_recursive', () { |
| 1359 final __test = new InterfaceTypeImplTest(); |
| 1360 runJUnitTest(__test, __test.test_isMoreSpecificThan_transitive_recursive
); |
| 1361 }); |
| 1362 _ut.test('test_isMoreSpecificThan_transitive_superclass', () { |
| 1363 final __test = new InterfaceTypeImplTest(); |
| 1364 runJUnitTest(__test, __test.test_isMoreSpecificThan_transitive_superclas
s); |
| 1365 }); |
1267 _ut.test('test_isSubtypeOf_directSubtype', () { | 1366 _ut.test('test_isSubtypeOf_directSubtype', () { |
1268 final __test = new InterfaceTypeImplTest(); | 1367 final __test = new InterfaceTypeImplTest(); |
1269 runJUnitTest(__test, __test.test_isSubtypeOf_directSubtype); | 1368 runJUnitTest(__test, __test.test_isSubtypeOf_directSubtype); |
1270 }); | 1369 }); |
1271 _ut.test('test_isSubtypeOf_dynamic', () { | 1370 _ut.test('test_isSubtypeOf_dynamic', () { |
1272 final __test = new InterfaceTypeImplTest(); | 1371 final __test = new InterfaceTypeImplTest(); |
1273 runJUnitTest(__test, __test.test_isSubtypeOf_dynamic); | 1372 runJUnitTest(__test, __test.test_isSubtypeOf_dynamic); |
1274 }); | 1373 }); |
1275 _ut.test('test_isSubtypeOf_indirectSubtype', () { | |
1276 final __test = new InterfaceTypeImplTest(); | |
1277 runJUnitTest(__test, __test.test_isSubtypeOf_indirectSubtype); | |
1278 }); | |
1279 _ut.test('test_isSubtypeOf_interface', () { | 1374 _ut.test('test_isSubtypeOf_interface', () { |
1280 final __test = new InterfaceTypeImplTest(); | 1375 final __test = new InterfaceTypeImplTest(); |
1281 runJUnitTest(__test, __test.test_isSubtypeOf_interface); | 1376 runJUnitTest(__test, __test.test_isSubtypeOf_interface); |
1282 }); | 1377 }); |
1283 _ut.test('test_isSubtypeOf_mixins', () { | 1378 _ut.test('test_isSubtypeOf_mixins', () { |
1284 final __test = new InterfaceTypeImplTest(); | 1379 final __test = new InterfaceTypeImplTest(); |
1285 runJUnitTest(__test, __test.test_isSubtypeOf_mixins); | 1380 runJUnitTest(__test, __test.test_isSubtypeOf_mixins); |
1286 }); | 1381 }); |
1287 _ut.test('test_isSubtypeOf_object', () { | 1382 _ut.test('test_isSubtypeOf_object', () { |
1288 final __test = new InterfaceTypeImplTest(); | 1383 final __test = new InterfaceTypeImplTest(); |
1289 runJUnitTest(__test, __test.test_isSubtypeOf_object); | 1384 runJUnitTest(__test, __test.test_isSubtypeOf_object); |
1290 }); | 1385 }); |
1291 _ut.test('test_isSubtypeOf_self', () { | 1386 _ut.test('test_isSubtypeOf_self', () { |
1292 final __test = new InterfaceTypeImplTest(); | 1387 final __test = new InterfaceTypeImplTest(); |
1293 runJUnitTest(__test, __test.test_isSubtypeOf_self); | 1388 runJUnitTest(__test, __test.test_isSubtypeOf_self); |
1294 }); | 1389 }); |
| 1390 _ut.test('test_isSubtypeOf_transitive_recursive', () { |
| 1391 final __test = new InterfaceTypeImplTest(); |
| 1392 runJUnitTest(__test, __test.test_isSubtypeOf_transitive_recursive); |
| 1393 }); |
| 1394 _ut.test('test_isSubtypeOf_transitive_superclass', () { |
| 1395 final __test = new InterfaceTypeImplTest(); |
| 1396 runJUnitTest(__test, __test.test_isSubtypeOf_transitive_superclass); |
| 1397 }); |
1295 _ut.test('test_isSubtypeOf_typeArguments', () { | 1398 _ut.test('test_isSubtypeOf_typeArguments', () { |
1296 final __test = new InterfaceTypeImplTest(); | 1399 final __test = new InterfaceTypeImplTest(); |
1297 runJUnitTest(__test, __test.test_isSubtypeOf_typeArguments); | 1400 runJUnitTest(__test, __test.test_isSubtypeOf_typeArguments); |
1298 }); | 1401 }); |
1299 _ut.test('test_isSupertypeOf_directSupertype', () { | 1402 _ut.test('test_isSupertypeOf_directSupertype', () { |
1300 final __test = new InterfaceTypeImplTest(); | 1403 final __test = new InterfaceTypeImplTest(); |
1301 runJUnitTest(__test, __test.test_isSupertypeOf_directSupertype); | 1404 runJUnitTest(__test, __test.test_isSupertypeOf_directSupertype); |
1302 }); | 1405 }); |
1303 _ut.test('test_isSupertypeOf_dynamic', () { | 1406 _ut.test('test_isSupertypeOf_dynamic', () { |
1304 final __test = new InterfaceTypeImplTest(); | 1407 final __test = new InterfaceTypeImplTest(); |
(...skipping 20 matching lines...) Expand all Loading... |
1325 runJUnitTest(__test, __test.test_isSupertypeOf_self); | 1428 runJUnitTest(__test, __test.test_isSupertypeOf_self); |
1326 }); | 1429 }); |
1327 _ut.test('test_lookUpGetter_implemented', () { | 1430 _ut.test('test_lookUpGetter_implemented', () { |
1328 final __test = new InterfaceTypeImplTest(); | 1431 final __test = new InterfaceTypeImplTest(); |
1329 runJUnitTest(__test, __test.test_lookUpGetter_implemented); | 1432 runJUnitTest(__test, __test.test_lookUpGetter_implemented); |
1330 }); | 1433 }); |
1331 _ut.test('test_lookUpGetter_inherited', () { | 1434 _ut.test('test_lookUpGetter_inherited', () { |
1332 final __test = new InterfaceTypeImplTest(); | 1435 final __test = new InterfaceTypeImplTest(); |
1333 runJUnitTest(__test, __test.test_lookUpGetter_inherited); | 1436 runJUnitTest(__test, __test.test_lookUpGetter_inherited); |
1334 }); | 1437 }); |
| 1438 _ut.test('test_lookUpGetter_recursive', () { |
| 1439 final __test = new InterfaceTypeImplTest(); |
| 1440 runJUnitTest(__test, __test.test_lookUpGetter_recursive); |
| 1441 }); |
1335 _ut.test('test_lookUpGetter_unimplemented', () { | 1442 _ut.test('test_lookUpGetter_unimplemented', () { |
1336 final __test = new InterfaceTypeImplTest(); | 1443 final __test = new InterfaceTypeImplTest(); |
1337 runJUnitTest(__test, __test.test_lookUpGetter_unimplemented); | 1444 runJUnitTest(__test, __test.test_lookUpGetter_unimplemented); |
1338 }); | 1445 }); |
1339 _ut.test('test_lookUpMethod_implemented', () { | 1446 _ut.test('test_lookUpMethod_implemented', () { |
1340 final __test = new InterfaceTypeImplTest(); | 1447 final __test = new InterfaceTypeImplTest(); |
1341 runJUnitTest(__test, __test.test_lookUpMethod_implemented); | 1448 runJUnitTest(__test, __test.test_lookUpMethod_implemented); |
1342 }); | 1449 }); |
1343 _ut.test('test_lookUpMethod_inherited', () { | 1450 _ut.test('test_lookUpMethod_inherited', () { |
1344 final __test = new InterfaceTypeImplTest(); | 1451 final __test = new InterfaceTypeImplTest(); |
1345 runJUnitTest(__test, __test.test_lookUpMethod_inherited); | 1452 runJUnitTest(__test, __test.test_lookUpMethod_inherited); |
1346 }); | 1453 }); |
1347 _ut.test('test_lookUpMethod_parameterized', () { | 1454 _ut.test('test_lookUpMethod_parameterized', () { |
1348 final __test = new InterfaceTypeImplTest(); | 1455 final __test = new InterfaceTypeImplTest(); |
1349 runJUnitTest(__test, __test.test_lookUpMethod_parameterized); | 1456 runJUnitTest(__test, __test.test_lookUpMethod_parameterized); |
1350 }); | 1457 }); |
| 1458 _ut.test('test_lookUpMethod_recursive', () { |
| 1459 final __test = new InterfaceTypeImplTest(); |
| 1460 runJUnitTest(__test, __test.test_lookUpMethod_recursive); |
| 1461 }); |
1351 _ut.test('test_lookUpMethod_unimplemented', () { | 1462 _ut.test('test_lookUpMethod_unimplemented', () { |
1352 final __test = new InterfaceTypeImplTest(); | 1463 final __test = new InterfaceTypeImplTest(); |
1353 runJUnitTest(__test, __test.test_lookUpMethod_unimplemented); | 1464 runJUnitTest(__test, __test.test_lookUpMethod_unimplemented); |
1354 }); | 1465 }); |
1355 _ut.test('test_lookUpSetter_implemented', () { | 1466 _ut.test('test_lookUpSetter_implemented', () { |
1356 final __test = new InterfaceTypeImplTest(); | 1467 final __test = new InterfaceTypeImplTest(); |
1357 runJUnitTest(__test, __test.test_lookUpSetter_implemented); | 1468 runJUnitTest(__test, __test.test_lookUpSetter_implemented); |
1358 }); | 1469 }); |
1359 _ut.test('test_lookUpSetter_inherited', () { | 1470 _ut.test('test_lookUpSetter_inherited', () { |
1360 final __test = new InterfaceTypeImplTest(); | 1471 final __test = new InterfaceTypeImplTest(); |
1361 runJUnitTest(__test, __test.test_lookUpSetter_inherited); | 1472 runJUnitTest(__test, __test.test_lookUpSetter_inherited); |
1362 }); | 1473 }); |
| 1474 _ut.test('test_lookUpSetter_recursive', () { |
| 1475 final __test = new InterfaceTypeImplTest(); |
| 1476 runJUnitTest(__test, __test.test_lookUpSetter_recursive); |
| 1477 }); |
1363 _ut.test('test_lookUpSetter_unimplemented', () { | 1478 _ut.test('test_lookUpSetter_unimplemented', () { |
1364 final __test = new InterfaceTypeImplTest(); | 1479 final __test = new InterfaceTypeImplTest(); |
1365 runJUnitTest(__test, __test.test_lookUpSetter_unimplemented); | 1480 runJUnitTest(__test, __test.test_lookUpSetter_unimplemented); |
1366 }); | 1481 }); |
1367 _ut.test('test_setTypeArguments', () { | 1482 _ut.test('test_setTypeArguments', () { |
1368 final __test = new InterfaceTypeImplTest(); | 1483 final __test = new InterfaceTypeImplTest(); |
1369 runJUnitTest(__test, __test.test_setTypeArguments); | 1484 runJUnitTest(__test, __test.test_setTypeArguments); |
1370 }); | 1485 }); |
1371 _ut.test('test_substitute_equal', () { | 1486 _ut.test('test_substitute_equal', () { |
1372 final __test = new InterfaceTypeImplTest(); | 1487 final __test = new InterfaceTypeImplTest(); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1415 final __test = new TypeVariableTypeImplTest(); | 1530 final __test = new TypeVariableTypeImplTest(); |
1416 runJUnitTest(__test, __test.test_substitute_equal); | 1531 runJUnitTest(__test, __test.test_substitute_equal); |
1417 }); | 1532 }); |
1418 _ut.test('test_substitute_notEqual', () { | 1533 _ut.test('test_substitute_notEqual', () { |
1419 final __test = new TypeVariableTypeImplTest(); | 1534 final __test = new TypeVariableTypeImplTest(); |
1420 runJUnitTest(__test, __test.test_substitute_notEqual); | 1535 runJUnitTest(__test, __test.test_substitute_notEqual); |
1421 }); | 1536 }); |
1422 }); | 1537 }); |
1423 } | 1538 } |
1424 } | 1539 } |
| 1540 |
1425 /** | 1541 /** |
1426 * The class {@code ElementFactory} defines utility methods used to create eleme
nts for testing | 1542 * The class {@code ElementFactory} defines utility methods used to create eleme
nts for testing |
1427 * purposes. The elements that are created are complete in the sense that as muc
h of the element | 1543 * purposes. The elements that are created are complete in the sense that as muc
h of the element |
1428 * model as can be created, given the provided information, has been created. | 1544 * model as can be created, given the provided information, has been created. |
1429 */ | 1545 */ |
1430 class ElementFactory { | 1546 class ElementFactory { |
| 1547 |
1431 /** | 1548 /** |
1432 * The element representing the class 'Object'. | 1549 * The element representing the class 'Object'. |
1433 */ | 1550 */ |
1434 static ClassElementImpl _objectElement; | 1551 static ClassElementImpl _objectElement; |
1435 static ClassElementImpl classElement(String typeName, InterfaceType superclass
Type, List<String> parameterNames) { | 1552 static ClassElementImpl classElement(String typeName, InterfaceType superclass
Type, List<String> parameterNames) { |
1436 ClassElementImpl element = new ClassElementImpl(ASTFactory.identifier3(typeN
ame)); | 1553 ClassElementImpl element = new ClassElementImpl(ASTFactory.identifier3(typeN
ame)); |
1437 element.supertype = superclassType; | 1554 element.supertype = superclassType; |
1438 InterfaceTypeImpl type = new InterfaceTypeImpl.con1(element); | 1555 InterfaceTypeImpl type = new InterfaceTypeImpl.con1(element); |
1439 element.type = type; | 1556 element.type = type; |
1440 int count = parameterNames.length; | 1557 int count = parameterNames.length; |
1441 if (count > 0) { | 1558 if (count > 0) { |
1442 List<TypeVariableElementImpl> typeVariables = new List<TypeVariableElement
Impl>(count); | 1559 List<TypeVariableElementImpl> typeVariables = new List<TypeVariableElement
Impl>(count); |
1443 List<TypeVariableTypeImpl> typeArguments = new List<TypeVariableTypeImpl>(
count); | 1560 List<TypeVariableTypeImpl> typeArguments = new List<TypeVariableTypeImpl>(
count); |
1444 for (int i = 0; i < count; i++) { | 1561 for (int i = 0; i < count; i++) { |
1445 TypeVariableElementImpl variable = new TypeVariableElementImpl(ASTFactor
y.identifier3(parameterNames[i])); | 1562 TypeVariableElementImpl variable = new TypeVariableElementImpl(ASTFactor
y.identifier3(parameterNames[i])); |
1446 typeVariables[i] = variable; | 1563 typeVariables[i] = variable; |
1447 typeArguments[i] = new TypeVariableTypeImpl(variable); | 1564 typeArguments[i] = new TypeVariableTypeImpl(variable); |
1448 variable.type = typeArguments[i]; | 1565 variable.type = typeArguments[i]; |
1449 } | 1566 } |
1450 element.typeVariables = typeVariables; | 1567 element.typeVariables = typeVariables; |
1451 type.typeArguments = typeArguments; | 1568 type.typeArguments = typeArguments; |
1452 } | 1569 } |
1453 return element; | 1570 return element; |
1454 } | 1571 } |
1455 static ClassElementImpl classElement2(String typeName, List<String> parameterN
ames) => classElement(typeName, object.type, parameterNames); | 1572 static ClassElementImpl classElement2(String typeName, List<String> parameterN
ames) => classElement(typeName, object.type, parameterNames); |
1456 static ConstructorElementImpl constructorElement(String name) => new Construct
orElementImpl(name == null ? null : ASTFactory.identifier3(name)); | 1573 static ConstructorElementImpl constructorElement(ClassElement clazz, String na
me) { |
| 1574 Type2 type2 = clazz.type; |
| 1575 ConstructorElementImpl constructor = new ConstructorElementImpl(name == null
? null : ASTFactory.identifier3(name)); |
| 1576 FunctionTypeImpl constructorType = new FunctionTypeImpl.con1(constructor); |
| 1577 constructorType.normalParameterTypes = <Type2> [type2]; |
| 1578 constructorType.returnType = type2; |
| 1579 constructor.type = constructorType; |
| 1580 return constructor; |
| 1581 } |
1457 static ExportElementImpl exportFor(LibraryElement exportedLibrary2, List<Names
paceCombinator> combinators2) { | 1582 static ExportElementImpl exportFor(LibraryElement exportedLibrary2, List<Names
paceCombinator> combinators2) { |
1458 ExportElementImpl spec = new ExportElementImpl(); | 1583 ExportElementImpl spec = new ExportElementImpl(); |
1459 spec.exportedLibrary = exportedLibrary2; | 1584 spec.exportedLibrary = exportedLibrary2; |
1460 spec.combinators = combinators2; | 1585 spec.combinators = combinators2; |
1461 return spec; | 1586 return spec; |
1462 } | 1587 } |
1463 static FieldElementImpl fieldElement(String name, bool isStatic, bool isFinal,
bool isConst, Type2 type2) { | 1588 static FieldElementImpl fieldElement(String name, bool isStatic, bool isFinal,
bool isConst, Type2 type2) { |
1464 FieldElementImpl field = new FieldElementImpl.con1(ASTFactory.identifier3(na
me)); | 1589 FieldElementImpl field = new FieldElementImpl.con1(ASTFactory.identifier3(na
me)); |
1465 field.const3 = isConst; | 1590 field.const3 = isConst; |
1466 field.final2 = isFinal; | 1591 field.final2 = isFinal; |
1467 field.static = isStatic; | 1592 field.static = isStatic; |
1468 field.type = type2; | 1593 field.type = type2; |
1469 PropertyAccessorElementImpl getter = new PropertyAccessorElementImpl.con2(fi
eld); | 1594 PropertyAccessorElementImpl getter = new PropertyAccessorElementImpl.con2(fi
eld); |
1470 getter.getter = true; | 1595 getter.getter = true; |
| 1596 getter.static = isStatic; |
1471 getter.synthetic = true; | 1597 getter.synthetic = true; |
| 1598 getter.variable = field; |
1472 field.getter = getter; | 1599 field.getter = getter; |
1473 FunctionTypeImpl getterType = new FunctionTypeImpl.con1(getter); | 1600 FunctionTypeImpl getterType = new FunctionTypeImpl.con1(getter); |
1474 getterType.returnType = type2; | 1601 getterType.returnType = type2; |
1475 getter.type = getterType; | 1602 getter.type = getterType; |
1476 if (!isConst && !isFinal) { | 1603 if (!isConst && !isFinal) { |
1477 PropertyAccessorElementImpl setter = new PropertyAccessorElementImpl.con2(
field); | 1604 PropertyAccessorElementImpl setter = new PropertyAccessorElementImpl.con2(
field); |
1478 setter.setter = true; | 1605 setter.setter = true; |
| 1606 setter.static = isStatic; |
1479 setter.synthetic = true; | 1607 setter.synthetic = true; |
| 1608 setter.variable = field; |
1480 field.setter = setter; | 1609 field.setter = setter; |
1481 FunctionTypeImpl setterType = new FunctionTypeImpl.con1(getter); | 1610 FunctionTypeImpl setterType = new FunctionTypeImpl.con1(getter); |
1482 setterType.normalParameterTypes = <Type2> [type2]; | 1611 setterType.normalParameterTypes = <Type2> [type2]; |
1483 setterType.returnType = VoidTypeImpl.instance; | 1612 setterType.returnType = VoidTypeImpl.instance; |
1484 setter.type = setterType; | 1613 setter.type = setterType; |
1485 } | 1614 } |
1486 return field; | 1615 return field; |
1487 } | 1616 } |
1488 static FieldFormalParameterElementImpl fieldFormalParameter(Identifier name) =
> new FieldFormalParameterElementImpl(name); | 1617 static FieldFormalParameterElementImpl fieldFormalParameter(Identifier name) =
> new FieldFormalParameterElementImpl(name); |
1489 static FunctionElementImpl functionElement(String functionName) => functionEle
ment4(functionName, null, null, null, null); | 1618 static FunctionElementImpl functionElement(String functionName) => functionEle
ment4(functionName, null, null, null, null); |
1490 static FunctionElementImpl functionElement2(String functionName, ClassElement
returnElement) => functionElement3(functionName, returnElement, null, null); | 1619 static FunctionElementImpl functionElement2(String functionName, ClassElement
returnElement) => functionElement3(functionName, returnElement, null, null); |
1491 static FunctionElementImpl functionElement3(String functionName, ClassElement
returnElement, List<ClassElement> normalParameters, List<ClassElement> optionalP
arameters) { | 1620 static FunctionElementImpl functionElement3(String functionName, ClassElement
returnElement, List<ClassElement> normalParameters, List<ClassElement> optionalP
arameters) { |
1492 FunctionElementImpl functionElement = new FunctionElementImpl.con1(ASTFactor
y.identifier3(functionName)); | 1621 FunctionElementImpl functionElement = new FunctionElementImpl.con1(ASTFactor
y.identifier3(functionName)); |
1493 FunctionTypeImpl functionType = new FunctionTypeImpl.con1(functionElement); | 1622 FunctionTypeImpl functionType = new FunctionTypeImpl.con1(functionElement); |
1494 functionElement.type = functionType; | 1623 functionElement.type = functionType; |
1495 if (returnElement != null) { | 1624 if (returnElement != null) { |
1496 functionType.returnType = returnElement.type; | 1625 functionType.returnType = returnElement.type; |
1497 } | 1626 } |
1498 int count = normalParameters == null ? 0 : normalParameters.length; | 1627 int normalCount = normalParameters == null ? 0 : normalParameters.length; |
1499 if (count > 0) { | 1628 if (normalCount > 0) { |
1500 List<InterfaceType> normalParameterTypes = new List<InterfaceType>(count); | 1629 List<InterfaceType> normalParameterTypes = new List<InterfaceType>(normalC
ount); |
1501 for (int i = 0; i < count; i++) { | 1630 for (int i = 0; i < normalCount; i++) { |
1502 normalParameterTypes[i] = normalParameters[i].type; | 1631 normalParameterTypes[i] = normalParameters[i].type; |
1503 } | 1632 } |
1504 functionType.normalParameterTypes = normalParameterTypes; | 1633 functionType.normalParameterTypes = normalParameterTypes; |
1505 } | 1634 } |
1506 count = optionalParameters == null ? 0 : optionalParameters.length; | 1635 int optionalCount = optionalParameters == null ? 0 : optionalParameters.leng
th; |
1507 if (count > 0) { | 1636 if (optionalCount > 0) { |
1508 List<InterfaceType> optionalParameterTypes = new List<InterfaceType>(count
); | 1637 List<InterfaceType> optionalParameterTypes = new List<InterfaceType>(optio
nalCount); |
1509 for (int i = 0; i < count; i++) { | 1638 for (int i = 0; i < optionalCount; i++) { |
1510 optionalParameterTypes[i] = optionalParameters[i].type; | 1639 optionalParameterTypes[i] = optionalParameters[i].type; |
1511 } | 1640 } |
1512 functionType.optionalParameterTypes = optionalParameterTypes; | 1641 functionType.optionalParameterTypes = optionalParameterTypes; |
1513 } | 1642 } |
| 1643 int totalCount = normalCount + optionalCount; |
| 1644 List<ParameterElement> parameters = new List<ParameterElement>(totalCount); |
| 1645 for (int i = 0; i < totalCount; i++) { |
| 1646 ParameterElementImpl parameter = new ParameterElementImpl(ASTFactory.ident
ifier3("a${i}")); |
| 1647 if (i < normalCount) { |
| 1648 parameter.type = normalParameters[i].type; |
| 1649 parameter.parameterKind = ParameterKind.REQUIRED; |
| 1650 } else { |
| 1651 parameter.type = optionalParameters[i - normalCount].type; |
| 1652 parameter.parameterKind = ParameterKind.POSITIONAL; |
| 1653 } |
| 1654 parameters[i] = parameter; |
| 1655 } |
| 1656 functionElement.parameters = parameters; |
1514 return functionElement; | 1657 return functionElement; |
1515 } | 1658 } |
1516 static FunctionElementImpl functionElement4(String functionName, ClassElement
returnElement, List<ClassElement> normalParameters, List<String> names, List<Cla
ssElement> namedParameters) { | 1659 static FunctionElementImpl functionElement4(String functionName, ClassElement
returnElement, List<ClassElement> normalParameters, List<String> names, List<Cla
ssElement> namedParameters) { |
1517 FunctionElementImpl functionElement = new FunctionElementImpl.con1(ASTFactor
y.identifier3(functionName)); | 1660 FunctionElementImpl functionElement = new FunctionElementImpl.con1(ASTFactor
y.identifier3(functionName)); |
1518 FunctionTypeImpl functionType = new FunctionTypeImpl.con1(functionElement); | 1661 FunctionTypeImpl functionType = new FunctionTypeImpl.con1(functionElement); |
1519 functionElement.type = functionType; | 1662 functionElement.type = functionType; |
1520 if (returnElement != null) { | 1663 if (returnElement != null) { |
1521 functionType.returnType = returnElement.type; | 1664 functionType.returnType = returnElement.type; |
1522 } | 1665 } |
1523 int count = normalParameters == null ? 0 : normalParameters.length; | 1666 int count = normalParameters == null ? 0 : normalParameters.length; |
(...skipping 24 matching lines...) Expand all Loading... |
1548 } | 1691 } |
1549 return _objectElement; | 1692 return _objectElement; |
1550 } | 1693 } |
1551 static PropertyAccessorElementImpl getterElement(String name, bool isStatic, T
ype2 type2) { | 1694 static PropertyAccessorElementImpl getterElement(String name, bool isStatic, T
ype2 type2) { |
1552 FieldElementImpl field = new FieldElementImpl.con1(ASTFactory.identifier3(na
me)); | 1695 FieldElementImpl field = new FieldElementImpl.con1(ASTFactory.identifier3(na
me)); |
1553 field.static = isStatic; | 1696 field.static = isStatic; |
1554 field.synthetic = true; | 1697 field.synthetic = true; |
1555 field.type = type2; | 1698 field.type = type2; |
1556 PropertyAccessorElementImpl getter = new PropertyAccessorElementImpl.con2(fi
eld); | 1699 PropertyAccessorElementImpl getter = new PropertyAccessorElementImpl.con2(fi
eld); |
1557 getter.getter = true; | 1700 getter.getter = true; |
| 1701 getter.static = isStatic; |
| 1702 getter.variable = field; |
1558 field.getter = getter; | 1703 field.getter = getter; |
1559 FunctionTypeImpl getterType = new FunctionTypeImpl.con1(getter); | 1704 FunctionTypeImpl getterType = new FunctionTypeImpl.con1(getter); |
1560 getterType.returnType = type2; | 1705 getterType.returnType = type2; |
1561 getter.type = getterType; | 1706 getter.type = getterType; |
1562 return getter; | 1707 return getter; |
1563 } | 1708 } |
1564 static ImportElementImpl importFor(LibraryElement importedLibrary2, PrefixElem
ent prefix2, List<NamespaceCombinator> combinators2) { | 1709 static ImportElementImpl importFor(LibraryElement importedLibrary2, PrefixElem
ent prefix2, List<NamespaceCombinator> combinators2) { |
1565 ImportElementImpl spec = new ImportElementImpl(); | 1710 ImportElementImpl spec = new ImportElementImpl(); |
1566 spec.importedLibrary = importedLibrary2; | 1711 spec.importedLibrary = importedLibrary2; |
1567 spec.prefix = prefix2; | 1712 spec.prefix = prefix2; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1612 parameter.parameterKind = ParameterKind.REQUIRED; | 1757 parameter.parameterKind = ParameterKind.REQUIRED; |
1613 return parameter; | 1758 return parameter; |
1614 } | 1759 } |
1615 static PropertyAccessorElementImpl setterElement(String name, bool isStatic, T
ype2 type2) { | 1760 static PropertyAccessorElementImpl setterElement(String name, bool isStatic, T
ype2 type2) { |
1616 FieldElementImpl field = new FieldElementImpl.con1(ASTFactory.identifier3(na
me)); | 1761 FieldElementImpl field = new FieldElementImpl.con1(ASTFactory.identifier3(na
me)); |
1617 field.static = isStatic; | 1762 field.static = isStatic; |
1618 field.synthetic = true; | 1763 field.synthetic = true; |
1619 field.type = type2; | 1764 field.type = type2; |
1620 PropertyAccessorElementImpl getter = new PropertyAccessorElementImpl.con2(fi
eld); | 1765 PropertyAccessorElementImpl getter = new PropertyAccessorElementImpl.con2(fi
eld); |
1621 getter.getter = true; | 1766 getter.getter = true; |
| 1767 getter.static = isStatic; |
| 1768 getter.variable = field; |
1622 field.getter = getter; | 1769 field.getter = getter; |
1623 FunctionTypeImpl getterType = new FunctionTypeImpl.con1(getter); | 1770 FunctionTypeImpl getterType = new FunctionTypeImpl.con1(getter); |
1624 getterType.returnType = type2; | 1771 getterType.returnType = type2; |
1625 getter.type = getterType; | 1772 getter.type = getterType; |
1626 PropertyAccessorElementImpl setter = new PropertyAccessorElementImpl.con2(fi
eld); | 1773 PropertyAccessorElementImpl setter = new PropertyAccessorElementImpl.con2(fi
eld); |
1627 setter.setter = true; | 1774 setter.setter = true; |
| 1775 setter.static = isStatic; |
1628 setter.synthetic = true; | 1776 setter.synthetic = true; |
| 1777 setter.variable = field; |
1629 field.setter = setter; | 1778 field.setter = setter; |
1630 FunctionTypeImpl setterType = new FunctionTypeImpl.con1(getter); | 1779 FunctionTypeImpl setterType = new FunctionTypeImpl.con1(getter); |
1631 setterType.normalParameterTypes = <Type2> [type2]; | 1780 setterType.normalParameterTypes = <Type2> [type2]; |
1632 setterType.returnType = VoidTypeImpl.instance; | 1781 setterType.returnType = VoidTypeImpl.instance; |
1633 setter.type = setterType; | 1782 setter.type = setterType; |
1634 return setter; | 1783 return setter; |
1635 } | 1784 } |
1636 static TopLevelVariableElementImpl topLevelVariableElement(Identifier name) =>
new TopLevelVariableElementImpl.con1(name); | 1785 static TopLevelVariableElementImpl topLevelVariableElement(Identifier name) =>
new TopLevelVariableElementImpl.con1(name); |
1637 static TopLevelVariableElementImpl topLevelVariableElement2(String name) => ne
w TopLevelVariableElementImpl.con2(name); | 1786 static TopLevelVariableElementImpl topLevelVariableElement2(String name) => ne
w TopLevelVariableElementImpl.con2(name); |
1638 /** | 1787 static TopLevelVariableElementImpl topLevelVariableElement3(String name, bool
isFinal, Type2 type2) { |
1639 * Prevent the creation of instances of this class. | 1788 TopLevelVariableElementImpl variable = new TopLevelVariableElementImpl.con2(
name); |
1640 */ | 1789 variable.final2 = isFinal; |
1641 ElementFactory() { | 1790 PropertyAccessorElementImpl getter = new PropertyAccessorElementImpl.con2(va
riable); |
| 1791 getter.getter = true; |
| 1792 getter.static = true; |
| 1793 getter.synthetic = true; |
| 1794 getter.variable = variable; |
| 1795 variable.getter = getter; |
| 1796 FunctionTypeImpl getterType = new FunctionTypeImpl.con1(getter); |
| 1797 getterType.returnType = type2; |
| 1798 getter.type = getterType; |
| 1799 if (!isFinal) { |
| 1800 PropertyAccessorElementImpl setter = new PropertyAccessorElementImpl.con2(
variable); |
| 1801 setter.setter = true; |
| 1802 setter.static = true; |
| 1803 setter.synthetic = true; |
| 1804 setter.variable = variable; |
| 1805 variable.setter = setter; |
| 1806 FunctionTypeImpl setterType = new FunctionTypeImpl.con1(getter); |
| 1807 setterType.normalParameterTypes = <Type2> [type2]; |
| 1808 setterType.returnType = VoidTypeImpl.instance; |
| 1809 setter.type = setterType; |
| 1810 } |
| 1811 return variable; |
1642 } | 1812 } |
1643 } | 1813 } |
1644 class ElementKindTest extends EngineTestCase { | 1814 class ElementKindTest extends EngineTestCase { |
1645 void test_of_nonNull() { | 1815 void test_of_nonNull() { |
1646 JUnitTestCase.assertSame(ElementKind.CLASS, ElementKind.of(ElementFactory.cl
assElement2("A", []))); | 1816 JUnitTestCase.assertSame(ElementKind.CLASS, ElementKind.of(ElementFactory.cl
assElement2("A", []))); |
1647 } | 1817 } |
1648 void test_of_null() { | 1818 void test_of_null() { |
1649 JUnitTestCase.assertSame(ElementKind.ERROR, ElementKind.of(null)); | 1819 JUnitTestCase.assertSame(ElementKind.ERROR, ElementKind.of(null)); |
1650 } | 1820 } |
1651 static dartSuite() { | 1821 static dartSuite() { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1689 InterfaceType typeC = classC.type; | 1859 InterfaceType typeC = classC.type; |
1690 classC.mixins = <InterfaceType> [typeB]; | 1860 classC.mixins = <InterfaceType> [typeB]; |
1691 List<InterfaceType> supers = classC.allSupertypes; | 1861 List<InterfaceType> supers = classC.allSupertypes; |
1692 List<InterfaceType> types = new List<InterfaceType>(); | 1862 List<InterfaceType> types = new List<InterfaceType>(); |
1693 types.addAll(supers); | 1863 types.addAll(supers); |
1694 JUnitTestCase.assertFalse(types.contains(typeA)); | 1864 JUnitTestCase.assertFalse(types.contains(typeA)); |
1695 JUnitTestCase.assertTrue(types.contains(typeB)); | 1865 JUnitTestCase.assertTrue(types.contains(typeB)); |
1696 JUnitTestCase.assertTrue(types.contains(typeObject)); | 1866 JUnitTestCase.assertTrue(types.contains(typeObject)); |
1697 JUnitTestCase.assertFalse(types.contains(typeC)); | 1867 JUnitTestCase.assertFalse(types.contains(typeC)); |
1698 } | 1868 } |
| 1869 void test_getAllSupertypes_recursive() { |
| 1870 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1871 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 1872 classA.supertype = classB.type; |
| 1873 List<InterfaceType> supers = classB.allSupertypes; |
| 1874 EngineTestCase.assertLength(1, supers); |
| 1875 } |
1699 void test_getMethod_declared() { | 1876 void test_getMethod_declared() { |
1700 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1877 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
1701 String methodName = "m"; | 1878 String methodName = "m"; |
1702 MethodElement method = ElementFactory.methodElement(methodName, null, []); | 1879 MethodElement method = ElementFactory.methodElement(methodName, null, []); |
1703 classA.methods = <MethodElement> [method]; | 1880 classA.methods = <MethodElement> [method]; |
1704 JUnitTestCase.assertSame(method, classA.getMethod(methodName)); | 1881 JUnitTestCase.assertSame(method, classA.getMethod(methodName)); |
1705 JUnitTestCase.assertSame(method, classA.getExecutable(methodName)); | |
1706 } | 1882 } |
1707 void test_getMethod_undeclared() { | 1883 void test_getMethod_undeclared() { |
1708 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1884 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
1709 String methodName = "m"; | 1885 String methodName = "m"; |
1710 MethodElement method = ElementFactory.methodElement(methodName, null, []); | 1886 MethodElement method = ElementFactory.methodElement(methodName, null, []); |
1711 classA.methods = <MethodElement> [method]; | 1887 classA.methods = <MethodElement> [method]; |
1712 JUnitTestCase.assertNull(classA.getMethod("${methodName}x")); | 1888 JUnitTestCase.assertNull(classA.getMethod("${methodName}x")); |
1713 JUnitTestCase.assertNull(classA.getExecutable("${methodName}x")); | 1889 } |
| 1890 void test_hasNonFinalField_false_const() { |
| 1891 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1892 classA.fields = <FieldElement> [ElementFactory.fieldElement("f", false, fals
e, true, classA.type)]; |
| 1893 JUnitTestCase.assertFalse(classA.hasNonFinalField()); |
| 1894 } |
| 1895 void test_hasNonFinalField_false_final() { |
| 1896 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1897 classA.fields = <FieldElement> [ElementFactory.fieldElement("f", false, true
, false, classA.type)]; |
| 1898 JUnitTestCase.assertFalse(classA.hasNonFinalField()); |
| 1899 } |
| 1900 void test_hasNonFinalField_false_recursive() { |
| 1901 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1902 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 1903 classA.supertype = classB.type; |
| 1904 JUnitTestCase.assertFalse(classA.hasNonFinalField()); |
| 1905 } |
| 1906 void test_hasNonFinalField_true_immediate() { |
| 1907 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1908 classA.fields = <FieldElement> [ElementFactory.fieldElement("f", false, fals
e, false, classA.type)]; |
| 1909 JUnitTestCase.assertTrue(classA.hasNonFinalField()); |
| 1910 } |
| 1911 void test_hasNonFinalField_true_inherited() { |
| 1912 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1913 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 1914 classA.fields = <FieldElement> [ElementFactory.fieldElement("f", false, fals
e, false, classA.type)]; |
| 1915 JUnitTestCase.assertTrue(classB.hasNonFinalField()); |
1714 } | 1916 } |
1715 void test_lookUpGetter_declared() { | 1917 void test_lookUpGetter_declared() { |
1716 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); | 1918 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); |
1717 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1919 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
1718 String getterName = "g"; | 1920 String getterName = "g"; |
1719 PropertyAccessorElement getter = ElementFactory.getterElement(getterName, fa
lse, null); | 1921 PropertyAccessorElement getter = ElementFactory.getterElement(getterName, fa
lse, null); |
1720 classA.accessors = <PropertyAccessorElement> [getter]; | 1922 classA.accessors = <PropertyAccessorElement> [getter]; |
1721 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = <
ClassElement> [classA]; | 1923 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = <
ClassElement> [classA]; |
1722 JUnitTestCase.assertSame(getter, classA.lookUpGetter(getterName, library2)); | 1924 JUnitTestCase.assertSame(getter, classA.lookUpGetter(getterName, library2)); |
1723 JUnitTestCase.assertSame(getter, classA.lookUpExecutable(getterName, library
2)); | |
1724 } | 1925 } |
1725 void test_lookUpGetter_inherited() { | 1926 void test_lookUpGetter_inherited() { |
1726 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); | 1927 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); |
1727 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1928 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
1728 String getterName = "g"; | 1929 String getterName = "g"; |
1729 PropertyAccessorElement getter = ElementFactory.getterElement(getterName, fa
lse, null); | 1930 PropertyAccessorElement getter = ElementFactory.getterElement(getterName, fa
lse, null); |
1730 classA.accessors = <PropertyAccessorElement> [getter]; | 1931 classA.accessors = <PropertyAccessorElement> [getter]; |
1731 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 1932 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
1732 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = <
ClassElement> [classA, classB]; | 1933 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = <
ClassElement> [classA, classB]; |
1733 JUnitTestCase.assertSame(getter, classB.lookUpGetter(getterName, library2)); | 1934 JUnitTestCase.assertSame(getter, classB.lookUpGetter(getterName, library2)); |
1734 JUnitTestCase.assertSame(getter, classB.lookUpExecutable(getterName, library
2)); | |
1735 } | 1935 } |
1736 void test_lookUpGetter_undeclared() { | 1936 void test_lookUpGetter_undeclared() { |
1737 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); | 1937 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); |
1738 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1938 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
1739 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = <
ClassElement> [classA]; | 1939 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = <
ClassElement> [classA]; |
1740 JUnitTestCase.assertNull(classA.lookUpGetter("g", library2)); | 1940 JUnitTestCase.assertNull(classA.lookUpGetter("g", library2)); |
1741 JUnitTestCase.assertNull(classA.lookUpExecutable("g", library2)); | 1941 } |
| 1942 void test_lookUpGetter_undeclared_recursive() { |
| 1943 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); |
| 1944 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1945 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 1946 classA.supertype = classB.type; |
| 1947 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = <
ClassElement> [classA, classB]; |
| 1948 JUnitTestCase.assertNull(classA.lookUpGetter("g", library2)); |
1742 } | 1949 } |
1743 void test_lookUpMethod_declared() { | 1950 void test_lookUpMethod_declared() { |
1744 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); | 1951 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); |
1745 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1952 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
1746 String methodName = "m"; | 1953 String methodName = "m"; |
1747 MethodElement method = ElementFactory.methodElement(methodName, null, []); | 1954 MethodElement method = ElementFactory.methodElement(methodName, null, []); |
1748 classA.methods = <MethodElement> [method]; | 1955 classA.methods = <MethodElement> [method]; |
1749 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = <
ClassElement> [classA]; | 1956 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = <
ClassElement> [classA]; |
1750 JUnitTestCase.assertSame(method, classA.lookUpMethod(methodName, library2)); | 1957 JUnitTestCase.assertSame(method, classA.lookUpMethod(methodName, library2)); |
1751 JUnitTestCase.assertSame(method, classA.lookUpExecutable(methodName, library
2)); | |
1752 } | 1958 } |
1753 void test_lookUpMethod_inherited() { | 1959 void test_lookUpMethod_inherited() { |
1754 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); | 1960 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); |
1755 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1961 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
1756 String methodName = "m"; | 1962 String methodName = "m"; |
1757 MethodElement method = ElementFactory.methodElement(methodName, null, []); | 1963 MethodElement method = ElementFactory.methodElement(methodName, null, []); |
1758 classA.methods = <MethodElement> [method]; | 1964 classA.methods = <MethodElement> [method]; |
1759 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 1965 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
1760 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = <
ClassElement> [classA, classB]; | 1966 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = <
ClassElement> [classA, classB]; |
1761 JUnitTestCase.assertSame(method, classB.lookUpMethod(methodName, library2)); | 1967 JUnitTestCase.assertSame(method, classB.lookUpMethod(methodName, library2)); |
1762 JUnitTestCase.assertSame(method, classB.lookUpExecutable(methodName, library
2)); | |
1763 } | 1968 } |
1764 void test_lookUpMethod_undeclared() { | 1969 void test_lookUpMethod_undeclared() { |
1765 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); | 1970 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); |
1766 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1971 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
1767 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = <
ClassElement> [classA]; | 1972 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = <
ClassElement> [classA]; |
1768 JUnitTestCase.assertNull(classA.lookUpMethod("m", library2)); | 1973 JUnitTestCase.assertNull(classA.lookUpMethod("m", library2)); |
1769 JUnitTestCase.assertNull(classA.lookUpExecutable("m", library2)); | 1974 } |
| 1975 void test_lookUpMethod_undeclared_recursive() { |
| 1976 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); |
| 1977 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1978 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 1979 classA.supertype = classB.type; |
| 1980 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = <
ClassElement> [classA, classB]; |
| 1981 JUnitTestCase.assertNull(classA.lookUpMethod("m", library2)); |
1770 } | 1982 } |
1771 void test_lookUpSetter_declared() { | 1983 void test_lookUpSetter_declared() { |
1772 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); | 1984 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); |
1773 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1985 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
1774 String setterName = "s"; | 1986 String setterName = "s"; |
1775 PropertyAccessorElement setter = ElementFactory.setterElement(setterName, fa
lse, null); | 1987 PropertyAccessorElement setter = ElementFactory.setterElement(setterName, fa
lse, null); |
1776 classA.accessors = <PropertyAccessorElement> [setter]; | 1988 classA.accessors = <PropertyAccessorElement> [setter]; |
1777 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = <
ClassElement> [classA]; | 1989 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = <
ClassElement> [classA]; |
1778 JUnitTestCase.assertSame(setter, classA.lookUpSetter(setterName, library2)); | 1990 JUnitTestCase.assertSame(setter, classA.lookUpSetter(setterName, library2)); |
1779 JUnitTestCase.assertSame(setter, classA.lookUpExecutable(setterName, library
2)); | |
1780 } | 1991 } |
1781 void test_lookUpSetter_inherited() { | 1992 void test_lookUpSetter_inherited() { |
1782 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); | 1993 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); |
1783 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1994 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
1784 String setterName = "s"; | 1995 String setterName = "s"; |
1785 PropertyAccessorElement setter = ElementFactory.setterElement(setterName, fa
lse, null); | 1996 PropertyAccessorElement setter = ElementFactory.setterElement(setterName, fa
lse, null); |
1786 classA.accessors = <PropertyAccessorElement> [setter]; | 1997 classA.accessors = <PropertyAccessorElement> [setter]; |
1787 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 1998 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
1788 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = <
ClassElement> [classA, classB]; | 1999 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = <
ClassElement> [classA, classB]; |
1789 JUnitTestCase.assertSame(setter, classB.lookUpSetter(setterName, library2)); | 2000 JUnitTestCase.assertSame(setter, classB.lookUpSetter(setterName, library2)); |
1790 JUnitTestCase.assertSame(setter, classB.lookUpExecutable(setterName, library
2)); | |
1791 } | 2001 } |
1792 void test_lookUpSetter_undeclared() { | 2002 void test_lookUpSetter_undeclared() { |
1793 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); | 2003 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); |
1794 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 2004 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
1795 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = <
ClassElement> [classA]; | 2005 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = <
ClassElement> [classA]; |
1796 JUnitTestCase.assertNull(classA.lookUpSetter("s", library2)); | 2006 JUnitTestCase.assertNull(classA.lookUpSetter("s", library2)); |
1797 JUnitTestCase.assertNull(classA.lookUpExecutable("s", library2)); | 2007 } |
| 2008 void test_lookUpSetter_undeclared_recursive() { |
| 2009 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); |
| 2010 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 2011 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 2012 classA.supertype = classB.type; |
| 2013 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = <
ClassElement> [classA, classB]; |
| 2014 JUnitTestCase.assertNull(classA.lookUpSetter("s", library2)); |
1798 } | 2015 } |
1799 static dartSuite() { | 2016 static dartSuite() { |
1800 _ut.group('ClassElementImplTest', () { | 2017 _ut.group('ClassElementImplTest', () { |
1801 _ut.test('test_getAllSupertypes_interface', () { | 2018 _ut.test('test_getAllSupertypes_interface', () { |
1802 final __test = new ClassElementImplTest(); | 2019 final __test = new ClassElementImplTest(); |
1803 runJUnitTest(__test, __test.test_getAllSupertypes_interface); | 2020 runJUnitTest(__test, __test.test_getAllSupertypes_interface); |
1804 }); | 2021 }); |
1805 _ut.test('test_getAllSupertypes_mixins', () { | 2022 _ut.test('test_getAllSupertypes_mixins', () { |
1806 final __test = new ClassElementImplTest(); | 2023 final __test = new ClassElementImplTest(); |
1807 runJUnitTest(__test, __test.test_getAllSupertypes_mixins); | 2024 runJUnitTest(__test, __test.test_getAllSupertypes_mixins); |
1808 }); | 2025 }); |
| 2026 _ut.test('test_getAllSupertypes_recursive', () { |
| 2027 final __test = new ClassElementImplTest(); |
| 2028 runJUnitTest(__test, __test.test_getAllSupertypes_recursive); |
| 2029 }); |
1809 _ut.test('test_getMethod_declared', () { | 2030 _ut.test('test_getMethod_declared', () { |
1810 final __test = new ClassElementImplTest(); | 2031 final __test = new ClassElementImplTest(); |
1811 runJUnitTest(__test, __test.test_getMethod_declared); | 2032 runJUnitTest(__test, __test.test_getMethod_declared); |
1812 }); | 2033 }); |
1813 _ut.test('test_getMethod_undeclared', () { | 2034 _ut.test('test_getMethod_undeclared', () { |
1814 final __test = new ClassElementImplTest(); | 2035 final __test = new ClassElementImplTest(); |
1815 runJUnitTest(__test, __test.test_getMethod_undeclared); | 2036 runJUnitTest(__test, __test.test_getMethod_undeclared); |
1816 }); | 2037 }); |
| 2038 _ut.test('test_hasNonFinalField_false_const', () { |
| 2039 final __test = new ClassElementImplTest(); |
| 2040 runJUnitTest(__test, __test.test_hasNonFinalField_false_const); |
| 2041 }); |
| 2042 _ut.test('test_hasNonFinalField_false_final', () { |
| 2043 final __test = new ClassElementImplTest(); |
| 2044 runJUnitTest(__test, __test.test_hasNonFinalField_false_final); |
| 2045 }); |
| 2046 _ut.test('test_hasNonFinalField_false_recursive', () { |
| 2047 final __test = new ClassElementImplTest(); |
| 2048 runJUnitTest(__test, __test.test_hasNonFinalField_false_recursive); |
| 2049 }); |
| 2050 _ut.test('test_hasNonFinalField_true_immediate', () { |
| 2051 final __test = new ClassElementImplTest(); |
| 2052 runJUnitTest(__test, __test.test_hasNonFinalField_true_immediate); |
| 2053 }); |
| 2054 _ut.test('test_hasNonFinalField_true_inherited', () { |
| 2055 final __test = new ClassElementImplTest(); |
| 2056 runJUnitTest(__test, __test.test_hasNonFinalField_true_inherited); |
| 2057 }); |
1817 _ut.test('test_lookUpGetter_declared', () { | 2058 _ut.test('test_lookUpGetter_declared', () { |
1818 final __test = new ClassElementImplTest(); | 2059 final __test = new ClassElementImplTest(); |
1819 runJUnitTest(__test, __test.test_lookUpGetter_declared); | 2060 runJUnitTest(__test, __test.test_lookUpGetter_declared); |
1820 }); | 2061 }); |
1821 _ut.test('test_lookUpGetter_inherited', () { | 2062 _ut.test('test_lookUpGetter_inherited', () { |
1822 final __test = new ClassElementImplTest(); | 2063 final __test = new ClassElementImplTest(); |
1823 runJUnitTest(__test, __test.test_lookUpGetter_inherited); | 2064 runJUnitTest(__test, __test.test_lookUpGetter_inherited); |
1824 }); | 2065 }); |
1825 _ut.test('test_lookUpGetter_undeclared', () { | 2066 _ut.test('test_lookUpGetter_undeclared', () { |
1826 final __test = new ClassElementImplTest(); | 2067 final __test = new ClassElementImplTest(); |
1827 runJUnitTest(__test, __test.test_lookUpGetter_undeclared); | 2068 runJUnitTest(__test, __test.test_lookUpGetter_undeclared); |
1828 }); | 2069 }); |
| 2070 _ut.test('test_lookUpGetter_undeclared_recursive', () { |
| 2071 final __test = new ClassElementImplTest(); |
| 2072 runJUnitTest(__test, __test.test_lookUpGetter_undeclared_recursive); |
| 2073 }); |
1829 _ut.test('test_lookUpMethod_declared', () { | 2074 _ut.test('test_lookUpMethod_declared', () { |
1830 final __test = new ClassElementImplTest(); | 2075 final __test = new ClassElementImplTest(); |
1831 runJUnitTest(__test, __test.test_lookUpMethod_declared); | 2076 runJUnitTest(__test, __test.test_lookUpMethod_declared); |
1832 }); | 2077 }); |
1833 _ut.test('test_lookUpMethod_inherited', () { | 2078 _ut.test('test_lookUpMethod_inherited', () { |
1834 final __test = new ClassElementImplTest(); | 2079 final __test = new ClassElementImplTest(); |
1835 runJUnitTest(__test, __test.test_lookUpMethod_inherited); | 2080 runJUnitTest(__test, __test.test_lookUpMethod_inherited); |
1836 }); | 2081 }); |
1837 _ut.test('test_lookUpMethod_undeclared', () { | 2082 _ut.test('test_lookUpMethod_undeclared', () { |
1838 final __test = new ClassElementImplTest(); | 2083 final __test = new ClassElementImplTest(); |
1839 runJUnitTest(__test, __test.test_lookUpMethod_undeclared); | 2084 runJUnitTest(__test, __test.test_lookUpMethod_undeclared); |
1840 }); | 2085 }); |
| 2086 _ut.test('test_lookUpMethod_undeclared_recursive', () { |
| 2087 final __test = new ClassElementImplTest(); |
| 2088 runJUnitTest(__test, __test.test_lookUpMethod_undeclared_recursive); |
| 2089 }); |
1841 _ut.test('test_lookUpSetter_declared', () { | 2090 _ut.test('test_lookUpSetter_declared', () { |
1842 final __test = new ClassElementImplTest(); | 2091 final __test = new ClassElementImplTest(); |
1843 runJUnitTest(__test, __test.test_lookUpSetter_declared); | 2092 runJUnitTest(__test, __test.test_lookUpSetter_declared); |
1844 }); | 2093 }); |
1845 _ut.test('test_lookUpSetter_inherited', () { | 2094 _ut.test('test_lookUpSetter_inherited', () { |
1846 final __test = new ClassElementImplTest(); | 2095 final __test = new ClassElementImplTest(); |
1847 runJUnitTest(__test, __test.test_lookUpSetter_inherited); | 2096 runJUnitTest(__test, __test.test_lookUpSetter_inherited); |
1848 }); | 2097 }); |
1849 _ut.test('test_lookUpSetter_undeclared', () { | 2098 _ut.test('test_lookUpSetter_undeclared', () { |
1850 final __test = new ClassElementImplTest(); | 2099 final __test = new ClassElementImplTest(); |
1851 runJUnitTest(__test, __test.test_lookUpSetter_undeclared); | 2100 runJUnitTest(__test, __test.test_lookUpSetter_undeclared); |
1852 }); | 2101 }); |
| 2102 _ut.test('test_lookUpSetter_undeclared_recursive', () { |
| 2103 final __test = new ClassElementImplTest(); |
| 2104 runJUnitTest(__test, __test.test_lookUpSetter_undeclared_recursive); |
| 2105 }); |
1853 }); | 2106 }); |
1854 } | 2107 } |
1855 } | 2108 } |
1856 class ElementImplTest extends EngineTestCase { | 2109 class ElementImplTest extends EngineTestCase { |
1857 void test_equals() { | 2110 void test_equals() { |
1858 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); | 2111 LibraryElementImpl library2 = ElementFactory.library(createAnalysisContext()
, "lib"); |
1859 ClassElementImpl classElement = ElementFactory.classElement2("C", []); | 2112 ClassElementImpl classElement = ElementFactory.classElement2("C", []); |
1860 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = <
ClassElement> [classElement]; | 2113 ((library2.definingCompilationUnit as CompilationUnitElementImpl)).types = <
ClassElement> [classElement]; |
1861 FieldElement field = ElementFactory.fieldElement("next", false, false, false
, classElement.type); | 2114 FieldElement field = ElementFactory.fieldElement("next", false, false, false
, classElement.type); |
1862 classElement.fields = <FieldElement> [field]; | 2115 classElement.fields = <FieldElement> [field]; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1950 void test_hashCode_element() { | 2203 void test_hashCode_element() { |
1951 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co
n1(ASTFactory.identifier3("f"))); | 2204 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co
n1(ASTFactory.identifier3("f"))); |
1952 type.hashCode; | 2205 type.hashCode; |
1953 } | 2206 } |
1954 void test_hashCode_noElement() { | 2207 void test_hashCode_noElement() { |
1955 FunctionTypeImpl type = new FunctionTypeImpl.con1((null as ExecutableElement
)); | 2208 FunctionTypeImpl type = new FunctionTypeImpl.con1((null as ExecutableElement
)); |
1956 type.hashCode; | 2209 type.hashCode; |
1957 } | 2210 } |
1958 void test_isSubtypeOf_baseCase_classFunction() { | 2211 void test_isSubtypeOf_baseCase_classFunction() { |
1959 ClassElementImpl functionElement = ElementFactory.classElement2("Function",
[]); | 2212 ClassElementImpl functionElement = ElementFactory.classElement2("Function",
[]); |
1960 InterfaceTypeImpl functionType = new InterfaceTypeImpl_18(functionElement); | 2213 InterfaceTypeImpl functionType = new InterfaceTypeImpl_19(functionElement); |
1961 FunctionType f = ElementFactory.functionElement("f").type; | 2214 FunctionType f = ElementFactory.functionElement("f").type; |
1962 JUnitTestCase.assertTrue(f.isSubtypeOf(functionType)); | 2215 JUnitTestCase.assertTrue(f.isSubtypeOf(functionType)); |
1963 } | 2216 } |
1964 void test_isSubtypeOf_baseCase_notFunctionType() { | 2217 void test_isSubtypeOf_baseCase_notFunctionType() { |
1965 FunctionType f = ElementFactory.functionElement("f").type; | 2218 FunctionType f = ElementFactory.functionElement("f").type; |
1966 InterfaceType t = ElementFactory.classElement2("C", []).type; | 2219 InterfaceType t = ElementFactory.classElement2("C", []).type; |
1967 JUnitTestCase.assertFalse(f.isSubtypeOf(t)); | 2220 JUnitTestCase.assertFalse(f.isSubtypeOf(t)); |
1968 } | 2221 } |
1969 void test_isSubtypeOf_baseCase_null() { | 2222 void test_isSubtypeOf_baseCase_null() { |
1970 FunctionType f = ElementFactory.functionElement("f").type; | 2223 FunctionType f = ElementFactory.functionElement("f").type; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2050 FunctionType s = ElementFactory.functionElement5("s", <ClassElement> [b, b])
.type; | 2303 FunctionType s = ElementFactory.functionElement5("s", <ClassElement> [b, b])
.type; |
2051 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); | 2304 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); |
2052 } | 2305 } |
2053 void test_isSubtypeOf_normalParameters_tHasMoreParams() { | 2306 void test_isSubtypeOf_normalParameters_tHasMoreParams() { |
2054 ClassElement a = ElementFactory.classElement2("A", []); | 2307 ClassElement a = ElementFactory.classElement2("A", []); |
2055 ClassElement b = ElementFactory.classElement("B", a.type, []); | 2308 ClassElement b = ElementFactory.classElement("B", a.type, []); |
2056 FunctionType t = ElementFactory.functionElement5("t", <ClassElement> [a, a])
.type; | 2309 FunctionType t = ElementFactory.functionElement5("t", <ClassElement> [a, a])
.type; |
2057 FunctionType s = ElementFactory.functionElement5("s", <ClassElement> [b]).ty
pe; | 2310 FunctionType s = ElementFactory.functionElement5("s", <ClassElement> [b]).ty
pe; |
2058 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); | 2311 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); |
2059 } | 2312 } |
| 2313 void test_isSubtypeOf_Object() { |
| 2314 FunctionType f = ElementFactory.functionElement("f").type; |
| 2315 InterfaceType t = ElementFactory.object.type; |
| 2316 JUnitTestCase.assertTrue(f.isSubtypeOf(t)); |
| 2317 } |
2060 void test_isSubtypeOf_optionalParameters_isAssignable() { | 2318 void test_isSubtypeOf_optionalParameters_isAssignable() { |
2061 ClassElement a = ElementFactory.classElement2("A", []); | 2319 ClassElement a = ElementFactory.classElement2("A", []); |
2062 ClassElement b = ElementFactory.classElement("B", a.type, []); | 2320 ClassElement b = ElementFactory.classElement("B", a.type, []); |
2063 FunctionType t = ElementFactory.functionElement6("t", null, <ClassElement> [
a]).type; | 2321 FunctionType t = ElementFactory.functionElement6("t", null, <ClassElement> [
a]).type; |
2064 FunctionType s = ElementFactory.functionElement6("s", null, <ClassElement> [
b]).type; | 2322 FunctionType s = ElementFactory.functionElement6("s", null, <ClassElement> [
b]).type; |
2065 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); | 2323 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); |
2066 JUnitTestCase.assertTrue(s.isSubtypeOf(t)); | 2324 JUnitTestCase.assertTrue(s.isSubtypeOf(t)); |
2067 } | 2325 } |
2068 void test_isSubtypeOf_optionalParameters_isNotAssignable() { | 2326 void test_isSubtypeOf_optionalParameters_isNotAssignable() { |
2069 FunctionType t = ElementFactory.functionElement6("t", null, <ClassElement> [
ElementFactory.classElement2("A", [])]).type; | 2327 FunctionType t = ElementFactory.functionElement6("t", null, <ClassElement> [
ElementFactory.classElement2("A", [])]).type; |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2231 runJUnitTest(__test, __test.test_getTypeArguments); | 2489 runJUnitTest(__test, __test.test_getTypeArguments); |
2232 }); | 2490 }); |
2233 _ut.test('test_hashCode_element', () { | 2491 _ut.test('test_hashCode_element', () { |
2234 final __test = new FunctionTypeImplTest(); | 2492 final __test = new FunctionTypeImplTest(); |
2235 runJUnitTest(__test, __test.test_hashCode_element); | 2493 runJUnitTest(__test, __test.test_hashCode_element); |
2236 }); | 2494 }); |
2237 _ut.test('test_hashCode_noElement', () { | 2495 _ut.test('test_hashCode_noElement', () { |
2238 final __test = new FunctionTypeImplTest(); | 2496 final __test = new FunctionTypeImplTest(); |
2239 runJUnitTest(__test, __test.test_hashCode_noElement); | 2497 runJUnitTest(__test, __test.test_hashCode_noElement); |
2240 }); | 2498 }); |
| 2499 _ut.test('test_isSubtypeOf_Object', () { |
| 2500 final __test = new FunctionTypeImplTest(); |
| 2501 runJUnitTest(__test, __test.test_isSubtypeOf_Object); |
| 2502 }); |
2241 _ut.test('test_isSubtypeOf_baseCase_classFunction', () { | 2503 _ut.test('test_isSubtypeOf_baseCase_classFunction', () { |
2242 final __test = new FunctionTypeImplTest(); | 2504 final __test = new FunctionTypeImplTest(); |
2243 runJUnitTest(__test, __test.test_isSubtypeOf_baseCase_classFunction); | 2505 runJUnitTest(__test, __test.test_isSubtypeOf_baseCase_classFunction); |
2244 }); | 2506 }); |
2245 _ut.test('test_isSubtypeOf_baseCase_notFunctionType', () { | 2507 _ut.test('test_isSubtypeOf_baseCase_notFunctionType', () { |
2246 final __test = new FunctionTypeImplTest(); | 2508 final __test = new FunctionTypeImplTest(); |
2247 runJUnitTest(__test, __test.test_isSubtypeOf_baseCase_notFunctionType); | 2509 runJUnitTest(__test, __test.test_isSubtypeOf_baseCase_notFunctionType); |
2248 }); | 2510 }); |
2249 _ut.test('test_isSubtypeOf_baseCase_null', () { | 2511 _ut.test('test_isSubtypeOf_baseCase_null', () { |
2250 final __test = new FunctionTypeImplTest(); | 2512 final __test = new FunctionTypeImplTest(); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2362 final __test = new FunctionTypeImplTest(); | 2624 final __test = new FunctionTypeImplTest(); |
2363 runJUnitTest(__test, __test.test_substitute2_equal); | 2625 runJUnitTest(__test, __test.test_substitute2_equal); |
2364 }); | 2626 }); |
2365 _ut.test('test_substitute2_notEqual', () { | 2627 _ut.test('test_substitute2_notEqual', () { |
2366 final __test = new FunctionTypeImplTest(); | 2628 final __test = new FunctionTypeImplTest(); |
2367 runJUnitTest(__test, __test.test_substitute2_notEqual); | 2629 runJUnitTest(__test, __test.test_substitute2_notEqual); |
2368 }); | 2630 }); |
2369 }); | 2631 }); |
2370 } | 2632 } |
2371 } | 2633 } |
2372 class InterfaceTypeImpl_18 extends InterfaceTypeImpl { | 2634 class InterfaceTypeImpl_19 extends InterfaceTypeImpl { |
2373 InterfaceTypeImpl_18(ClassElement arg0) : super.con1(arg0); | 2635 InterfaceTypeImpl_19(ClassElement arg0) : super.con1(arg0); |
2374 bool isDartCoreFunction() => true; | 2636 bool isDartCoreFunction() => true; |
2375 } | 2637 } |
2376 main() { | 2638 main() { |
2377 ElementKindTest.dartSuite(); | 2639 ElementKindTest.dartSuite(); |
2378 FunctionTypeImplTest.dartSuite(); | 2640 FunctionTypeImplTest.dartSuite(); |
2379 InterfaceTypeImplTest.dartSuite(); | 2641 InterfaceTypeImplTest.dartSuite(); |
2380 TypeVariableTypeImplTest.dartSuite(); | 2642 TypeVariableTypeImplTest.dartSuite(); |
2381 ClassElementImplTest.dartSuite(); | 2643 ClassElementImplTest.dartSuite(); |
2382 ElementLocationImplTest.dartSuite(); | 2644 ElementLocationImplTest.dartSuite(); |
2383 ElementImplTest.dartSuite(); | 2645 ElementImplTest.dartSuite(); |
2384 LibraryElementImplTest.dartSuite(); | 2646 LibraryElementImplTest.dartSuite(); |
2385 } | 2647 } |
OLD | NEW |