| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library engine.element_test; | 8 library engine.element_test; |
| 9 | 9 |
| 10 import 'package:analyzer/src/generated/java_core.dart'; | 10 import 'package:analyzer/src/generated/java_core.dart'; |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 AnalysisContext context = createAnalysisContext(); | 285 AnalysisContext context = createAnalysisContext(); |
| 286 LibraryElementImpl library = ElementFactory.library(context, "app"); | 286 LibraryElementImpl library = ElementFactory.library(context, "app"); |
| 287 EngineTestCase.assertEqualsIgnoreOrder(<LibraryElement> [library], library.v
isibleLibraries); | 287 EngineTestCase.assertEqualsIgnoreOrder(<LibraryElement> [library], library.v
isibleLibraries); |
| 288 } | 288 } |
| 289 | 289 |
| 290 void test_isUpToDate() { | 290 void test_isUpToDate() { |
| 291 AnalysisContext context = createAnalysisContext(); | 291 AnalysisContext context = createAnalysisContext(); |
| 292 context.sourceFactory = new SourceFactory.con2([]); | 292 context.sourceFactory = new SourceFactory.con2([]); |
| 293 LibraryElement library = ElementFactory.library(context, "foo"); | 293 LibraryElement library = ElementFactory.library(context, "foo"); |
| 294 context.sourceFactory.setContents(library.definingCompilationUnit.source, "s
dfsdff"); | 294 context.sourceFactory.setContents(library.definingCompilationUnit.source, "s
dfsdff"); |
| 295 // Assert that we are not up to date if the target has an old time stamp. |
| 295 JUnitTestCase.assertFalse(library.isUpToDate2(0)); | 296 JUnitTestCase.assertFalse(library.isUpToDate2(0)); |
| 297 // Assert that we are up to date with a target modification time in the futu
re. |
| 296 JUnitTestCase.assertTrue(library.isUpToDate2(JavaSystem.currentTimeMillis()
+ 1000)); | 298 JUnitTestCase.assertTrue(library.isUpToDate2(JavaSystem.currentTimeMillis()
+ 1000)); |
| 297 } | 299 } |
| 298 | 300 |
| 299 void test_setImports() { | 301 void test_setImports() { |
| 300 AnalysisContext context = createAnalysisContext(); | 302 AnalysisContext context = createAnalysisContext(); |
| 301 LibraryElementImpl library = new LibraryElementImpl(context, ASTFactory.libr
aryIdentifier2(["l1"])); | 303 LibraryElementImpl library = new LibraryElementImpl(context, ASTFactory.libr
aryIdentifier2(["l1"])); |
| 302 List<ImportElementImpl> expectedImports = [ | 304 List<ImportElementImpl> expectedImports = [ |
| 303 ElementFactory.importFor(ElementFactory.library(context, "l2"), null, []
), | 305 ElementFactory.importFor(ElementFactory.library(context, "l2"), null, []
), |
| 304 ElementFactory.importFor(ElementFactory.library(context, "l3"), null, []
)]; | 306 ElementFactory.importFor(ElementFactory.library(context, "l3"), null, []
)]; |
| 305 library.imports = expectedImports; | 307 library.imports = expectedImports; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 | 369 |
| 368 void test_getElement() { | 370 void test_getElement() { |
| 369 TypeParameterElementImpl element = new TypeParameterElementImpl(ASTFactory.i
dentifier3("E")); | 371 TypeParameterElementImpl element = new TypeParameterElementImpl(ASTFactory.i
dentifier3("E")); |
| 370 TypeParameterTypeImpl type = new TypeParameterTypeImpl(element); | 372 TypeParameterTypeImpl type = new TypeParameterTypeImpl(element); |
| 371 JUnitTestCase.assertEquals(element, type.element); | 373 JUnitTestCase.assertEquals(element, type.element); |
| 372 } | 374 } |
| 373 | 375 |
| 374 void test_isMoreSpecificThan_typeArguments_bottom() { | 376 void test_isMoreSpecificThan_typeArguments_bottom() { |
| 375 TypeParameterElementImpl element = new TypeParameterElementImpl(ASTFactory.i
dentifier3("E")); | 377 TypeParameterElementImpl element = new TypeParameterElementImpl(ASTFactory.i
dentifier3("E")); |
| 376 TypeParameterTypeImpl type = new TypeParameterTypeImpl(element); | 378 TypeParameterTypeImpl type = new TypeParameterTypeImpl(element); |
| 379 // E << bottom |
| 377 JUnitTestCase.assertTrue(type.isMoreSpecificThan(BottomTypeImpl.instance)); | 380 JUnitTestCase.assertTrue(type.isMoreSpecificThan(BottomTypeImpl.instance)); |
| 378 } | 381 } |
| 379 | 382 |
| 380 void test_isMoreSpecificThan_typeArguments_dynamic() { | 383 void test_isMoreSpecificThan_typeArguments_dynamic() { |
| 381 TypeParameterElementImpl element = new TypeParameterElementImpl(ASTFactory.i
dentifier3("E")); | 384 TypeParameterElementImpl element = new TypeParameterElementImpl(ASTFactory.i
dentifier3("E")); |
| 382 TypeParameterTypeImpl type = new TypeParameterTypeImpl(element); | 385 TypeParameterTypeImpl type = new TypeParameterTypeImpl(element); |
| 386 // E << dynamic |
| 383 JUnitTestCase.assertTrue(type.isMoreSpecificThan(DynamicTypeImpl.instance)); | 387 JUnitTestCase.assertTrue(type.isMoreSpecificThan(DynamicTypeImpl.instance)); |
| 384 } | 388 } |
| 385 | 389 |
| 386 void test_isMoreSpecificThan_typeArguments_object() { | 390 void test_isMoreSpecificThan_typeArguments_object() { |
| 387 TypeParameterElementImpl element = new TypeParameterElementImpl(ASTFactory.i
dentifier3("E")); | 391 TypeParameterElementImpl element = new TypeParameterElementImpl(ASTFactory.i
dentifier3("E")); |
| 388 TypeParameterTypeImpl type = new TypeParameterTypeImpl(element); | 392 TypeParameterTypeImpl type = new TypeParameterTypeImpl(element); |
| 393 // E << Object |
| 389 JUnitTestCase.assertTrue(type.isMoreSpecificThan(ElementFactory.object.type)
); | 394 JUnitTestCase.assertTrue(type.isMoreSpecificThan(ElementFactory.object.type)
); |
| 390 } | 395 } |
| 391 | 396 |
| 392 void test_isMoreSpecificThan_typeArguments_resursive() { | 397 void test_isMoreSpecificThan_typeArguments_resursive() { |
| 393 ClassElementImpl classS = ElementFactory.classElement2("A", []); | 398 ClassElementImpl classS = ElementFactory.classElement2("A", []); |
| 394 TypeParameterElementImpl typeParameterU = new TypeParameterElementImpl(ASTFa
ctory.identifier3("U")); | 399 TypeParameterElementImpl typeParameterU = new TypeParameterElementImpl(ASTFa
ctory.identifier3("U")); |
| 395 TypeParameterTypeImpl typeParameterTypeU = new TypeParameterTypeImpl(typePar
ameterU); | 400 TypeParameterTypeImpl typeParameterTypeU = new TypeParameterTypeImpl(typePar
ameterU); |
| 396 TypeParameterElementImpl typeParameterT = new TypeParameterElementImpl(ASTFa
ctory.identifier3("T")); | 401 TypeParameterElementImpl typeParameterT = new TypeParameterElementImpl(ASTFa
ctory.identifier3("T")); |
| 397 TypeParameterTypeImpl typeParameterTypeT = new TypeParameterTypeImpl(typePar
ameterT); | 402 TypeParameterTypeImpl typeParameterTypeT = new TypeParameterTypeImpl(typePar
ameterT); |
| 398 typeParameterT.bound = typeParameterTypeU; | 403 typeParameterT.bound = typeParameterTypeU; |
| 399 typeParameterU.bound = typeParameterTypeU; | 404 typeParameterU.bound = typeParameterTypeU; |
| 405 // <T extends U> and <U extends T> |
| 406 // T << S |
| 400 JUnitTestCase.assertFalse(typeParameterTypeT.isMoreSpecificThan(classS.type)
); | 407 JUnitTestCase.assertFalse(typeParameterTypeT.isMoreSpecificThan(classS.type)
); |
| 401 } | 408 } |
| 402 | 409 |
| 403 void test_isMoreSpecificThan_typeArguments_self() { | 410 void test_isMoreSpecificThan_typeArguments_self() { |
| 404 TypeParameterElementImpl element = new TypeParameterElementImpl(ASTFactory.i
dentifier3("E")); | 411 TypeParameterElementImpl element = new TypeParameterElementImpl(ASTFactory.i
dentifier3("E")); |
| 405 TypeParameterTypeImpl type = new TypeParameterTypeImpl(element); | 412 TypeParameterTypeImpl type = new TypeParameterTypeImpl(element); |
| 413 // E << E |
| 406 JUnitTestCase.assertTrue(type.isMoreSpecificThan(type)); | 414 JUnitTestCase.assertTrue(type.isMoreSpecificThan(type)); |
| 407 } | 415 } |
| 408 | 416 |
| 409 void test_isMoreSpecificThan_typeArguments_transitivity_interfaceTypes() { | 417 void test_isMoreSpecificThan_typeArguments_transitivity_interfaceTypes() { |
| 418 // class A {} |
| 419 // class B extends A {} |
| 420 // |
| 410 ClassElement classA = ElementFactory.classElement2("A", []); | 421 ClassElement classA = ElementFactory.classElement2("A", []); |
| 411 ClassElement classB = ElementFactory.classElement("B", classA.type, []); | 422 ClassElement classB = ElementFactory.classElement("B", classA.type, []); |
| 412 InterfaceType typeA = classA.type; | 423 InterfaceType typeA = classA.type; |
| 413 InterfaceType typeB = classB.type; | 424 InterfaceType typeB = classB.type; |
| 414 TypeParameterElementImpl typeParameterT = new TypeParameterElementImpl(ASTFa
ctory.identifier3("T")); | 425 TypeParameterElementImpl typeParameterT = new TypeParameterElementImpl(ASTFa
ctory.identifier3("T")); |
| 415 typeParameterT.bound = typeB; | 426 typeParameterT.bound = typeB; |
| 416 TypeParameterTypeImpl typeParameterTypeT = new TypeParameterTypeImpl(typePar
ameterT); | 427 TypeParameterTypeImpl typeParameterTypeT = new TypeParameterTypeImpl(typePar
ameterT); |
| 428 // <T extends B> |
| 429 // T << A |
| 417 JUnitTestCase.assertTrue(typeParameterTypeT.isMoreSpecificThan(typeA)); | 430 JUnitTestCase.assertTrue(typeParameterTypeT.isMoreSpecificThan(typeA)); |
| 418 } | 431 } |
| 419 | 432 |
| 420 void test_isMoreSpecificThan_typeArguments_transitivity_typeParameters() { | 433 void test_isMoreSpecificThan_typeArguments_transitivity_typeParameters() { |
| 421 ClassElementImpl classS = ElementFactory.classElement2("A", []); | 434 ClassElementImpl classS = ElementFactory.classElement2("A", []); |
| 422 TypeParameterElementImpl typeParameterU = new TypeParameterElementImpl(ASTFa
ctory.identifier3("U")); | 435 TypeParameterElementImpl typeParameterU = new TypeParameterElementImpl(ASTFa
ctory.identifier3("U")); |
| 423 typeParameterU.bound = classS.type; | 436 typeParameterU.bound = classS.type; |
| 424 TypeParameterTypeImpl typeParameterTypeU = new TypeParameterTypeImpl(typePar
ameterU); | 437 TypeParameterTypeImpl typeParameterTypeU = new TypeParameterTypeImpl(typePar
ameterU); |
| 425 TypeParameterElementImpl typeParameterT = new TypeParameterElementImpl(ASTFa
ctory.identifier3("T")); | 438 TypeParameterElementImpl typeParameterT = new TypeParameterElementImpl(ASTFa
ctory.identifier3("T")); |
| 426 typeParameterT.bound = typeParameterTypeU; | 439 typeParameterT.bound = typeParameterTypeU; |
| 427 TypeParameterTypeImpl typeParameterTypeT = new TypeParameterTypeImpl(typePar
ameterT); | 440 TypeParameterTypeImpl typeParameterTypeT = new TypeParameterTypeImpl(typePar
ameterT); |
| 441 // <T extends U> and <U extends S> |
| 442 // T << S |
| 428 JUnitTestCase.assertTrue(typeParameterTypeT.isMoreSpecificThan(classS.type))
; | 443 JUnitTestCase.assertTrue(typeParameterTypeT.isMoreSpecificThan(classS.type))
; |
| 429 } | 444 } |
| 430 | 445 |
| 431 void test_isMoreSpecificThan_typeArguments_upperBound() { | 446 void test_isMoreSpecificThan_typeArguments_upperBound() { |
| 432 ClassElementImpl classS = ElementFactory.classElement2("A", []); | 447 ClassElementImpl classS = ElementFactory.classElement2("A", []); |
| 433 TypeParameterElementImpl typeParameterT = new TypeParameterElementImpl(ASTFa
ctory.identifier3("T")); | 448 TypeParameterElementImpl typeParameterT = new TypeParameterElementImpl(ASTFa
ctory.identifier3("T")); |
| 434 typeParameterT.bound = classS.type; | 449 typeParameterT.bound = classS.type; |
| 435 TypeParameterTypeImpl typeParameterTypeT = new TypeParameterTypeImpl(typePar
ameterT); | 450 TypeParameterTypeImpl typeParameterTypeT = new TypeParameterTypeImpl(typePar
ameterT); |
| 451 // <T extends S> |
| 452 // T << S |
| 436 JUnitTestCase.assertTrue(typeParameterTypeT.isMoreSpecificThan(classS.type))
; | 453 JUnitTestCase.assertTrue(typeParameterTypeT.isMoreSpecificThan(classS.type))
; |
| 437 } | 454 } |
| 438 | 455 |
| 439 void test_substitute_equal() { | 456 void test_substitute_equal() { |
| 440 TypeParameterElementImpl element = new TypeParameterElementImpl(ASTFactory.i
dentifier3("E")); | 457 TypeParameterElementImpl element = new TypeParameterElementImpl(ASTFactory.i
dentifier3("E")); |
| 441 TypeParameterTypeImpl type = new TypeParameterTypeImpl(element); | 458 TypeParameterTypeImpl type = new TypeParameterTypeImpl(element); |
| 442 InterfaceTypeImpl argument = new InterfaceTypeImpl.con1(new ClassElementImpl
(ASTFactory.identifier3("A"))); | 459 InterfaceTypeImpl argument = new InterfaceTypeImpl.con1(new ClassElementImpl
(ASTFactory.identifier3("A"))); |
| 443 TypeParameterTypeImpl parameter = new TypeParameterTypeImpl(element); | 460 TypeParameterTypeImpl parameter = new TypeParameterTypeImpl(element); |
| 444 JUnitTestCase.assertSame(argument, type.substitute2(<Type2> [argument], <Typ
e2> [parameter])); | 461 JUnitTestCase.assertSame(argument, type.substitute2(<Type2> [argument], <Typ
e2> [parameter])); |
| 445 } | 462 } |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 /** | 526 /** |
| 510 * The type provider used to access the types. | 527 * The type provider used to access the types. |
| 511 */ | 528 */ |
| 512 TestTypeProvider _typeProvider; | 529 TestTypeProvider _typeProvider; |
| 513 | 530 |
| 514 void setUp() { | 531 void setUp() { |
| 515 _typeProvider = new TestTypeProvider(); | 532 _typeProvider = new TestTypeProvider(); |
| 516 } | 533 } |
| 517 | 534 |
| 518 void test_computeLongestInheritancePathToObject_multipleInterfacePaths() { | 535 void test_computeLongestInheritancePathToObject_multipleInterfacePaths() { |
| 536 // |
| 537 // Object |
| 538 // | |
| 539 // A |
| 540 // / \ |
| 541 // B C |
| 542 // | | |
| 543 // | D |
| 544 // \ / |
| 545 // E |
| 546 // |
| 519 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 547 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 520 ClassElementImpl classB = ElementFactory.classElement2("B", []); | 548 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 521 ClassElementImpl classC = ElementFactory.classElement2("C", []); | 549 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
| 522 ClassElementImpl classD = ElementFactory.classElement2("D", []); | 550 ClassElementImpl classD = ElementFactory.classElement2("D", []); |
| 523 ClassElementImpl classE = ElementFactory.classElement2("E", []); | 551 ClassElementImpl classE = ElementFactory.classElement2("E", []); |
| 524 classB.interfaces = <InterfaceType> [classA.type]; | 552 classB.interfaces = <InterfaceType> [classA.type]; |
| 525 classC.interfaces = <InterfaceType> [classA.type]; | 553 classC.interfaces = <InterfaceType> [classA.type]; |
| 526 classD.interfaces = <InterfaceType> [classC.type]; | 554 classD.interfaces = <InterfaceType> [classC.type]; |
| 527 classE.interfaces = <InterfaceType> [classB.type, classD.type]; | 555 classE.interfaces = <InterfaceType> [classB.type, classD.type]; |
| 556 // assertion: even though the longest path to Object for typeB is 2, and typ
eE implements typeB, |
| 557 // the longest path for typeE is 4 since it also implements typeD |
| 528 JUnitTestCase.assertEquals(2, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classB.type)); | 558 JUnitTestCase.assertEquals(2, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classB.type)); |
| 529 JUnitTestCase.assertEquals(4, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classE.type)); | 559 JUnitTestCase.assertEquals(4, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classE.type)); |
| 530 } | 560 } |
| 531 | 561 |
| 532 void test_computeLongestInheritancePathToObject_multipleSuperclassPaths() { | 562 void test_computeLongestInheritancePathToObject_multipleSuperclassPaths() { |
| 563 // |
| 564 // Object |
| 565 // | |
| 566 // A |
| 567 // / \ |
| 568 // B C |
| 569 // | | |
| 570 // | D |
| 571 // \ / |
| 572 // E |
| 573 // |
| 533 ClassElement classA = ElementFactory.classElement2("A", []); | 574 ClassElement classA = ElementFactory.classElement2("A", []); |
| 534 ClassElement classB = ElementFactory.classElement("B", classA.type, []); | 575 ClassElement classB = ElementFactory.classElement("B", classA.type, []); |
| 535 ClassElement classC = ElementFactory.classElement("C", classA.type, []); | 576 ClassElement classC = ElementFactory.classElement("C", classA.type, []); |
| 536 ClassElement classD = ElementFactory.classElement("D", classC.type, []); | 577 ClassElement classD = ElementFactory.classElement("D", classC.type, []); |
| 537 ClassElementImpl classE = ElementFactory.classElement("E", classB.type, []); | 578 ClassElementImpl classE = ElementFactory.classElement("E", classB.type, []); |
| 538 classE.interfaces = <InterfaceType> [classD.type]; | 579 classE.interfaces = <InterfaceType> [classD.type]; |
| 580 // assertion: even though the longest path to Object for typeB is 2, and typ
eE extends typeB, |
| 581 // the longest path for typeE is 4 since it also implements typeD |
| 539 JUnitTestCase.assertEquals(2, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classB.type)); | 582 JUnitTestCase.assertEquals(2, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classB.type)); |
| 540 JUnitTestCase.assertEquals(4, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classE.type)); | 583 JUnitTestCase.assertEquals(4, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classE.type)); |
| 541 } | 584 } |
| 542 | 585 |
| 543 void test_computeLongestInheritancePathToObject_object() { | 586 void test_computeLongestInheritancePathToObject_object() { |
| 587 // |
| 588 // Object |
| 589 // | |
| 590 // A |
| 591 // |
| 544 ClassElement classA = ElementFactory.classElement2("A", []); | 592 ClassElement classA = ElementFactory.classElement2("A", []); |
| 545 InterfaceType object = classA.supertype; | 593 InterfaceType object = classA.supertype; |
| 546 JUnitTestCase.assertEquals(0, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(object)); | 594 JUnitTestCase.assertEquals(0, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(object)); |
| 547 } | 595 } |
| 548 | 596 |
| 549 void test_computeLongestInheritancePathToObject_recursion() { | 597 void test_computeLongestInheritancePathToObject_recursion() { |
| 550 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 598 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 551 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 599 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 552 classA.supertype = classB.type; | 600 classA.supertype = classB.type; |
| 553 JUnitTestCase.assertEquals(2, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classA.type)); | 601 JUnitTestCase.assertEquals(2, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classA.type)); |
| 554 } | 602 } |
| 555 | 603 |
| 556 void test_computeLongestInheritancePathToObject_singleInterfacePath() { | 604 void test_computeLongestInheritancePathToObject_singleInterfacePath() { |
| 605 // |
| 606 // Object |
| 607 // | |
| 608 // A |
| 609 // | |
| 610 // B |
| 611 // | |
| 612 // C |
| 613 // |
| 557 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 614 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 558 ClassElementImpl classB = ElementFactory.classElement2("B", []); | 615 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 559 ClassElementImpl classC = ElementFactory.classElement2("C", []); | 616 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
| 560 classB.interfaces = <InterfaceType> [classA.type]; | 617 classB.interfaces = <InterfaceType> [classA.type]; |
| 561 classC.interfaces = <InterfaceType> [classB.type]; | 618 classC.interfaces = <InterfaceType> [classB.type]; |
| 562 JUnitTestCase.assertEquals(1, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classA.type)); | 619 JUnitTestCase.assertEquals(1, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classA.type)); |
| 563 JUnitTestCase.assertEquals(2, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classB.type)); | 620 JUnitTestCase.assertEquals(2, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classB.type)); |
| 564 JUnitTestCase.assertEquals(3, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classC.type)); | 621 JUnitTestCase.assertEquals(3, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classC.type)); |
| 565 } | 622 } |
| 566 | 623 |
| 567 void test_computeLongestInheritancePathToObject_singleSuperclassPath() { | 624 void test_computeLongestInheritancePathToObject_singleSuperclassPath() { |
| 625 // |
| 626 // Object |
| 627 // | |
| 628 // A |
| 629 // | |
| 630 // B |
| 631 // | |
| 632 // C |
| 633 // |
| 568 ClassElement classA = ElementFactory.classElement2("A", []); | 634 ClassElement classA = ElementFactory.classElement2("A", []); |
| 569 ClassElement classB = ElementFactory.classElement("B", classA.type, []); | 635 ClassElement classB = ElementFactory.classElement("B", classA.type, []); |
| 570 ClassElement classC = ElementFactory.classElement("C", classB.type, []); | 636 ClassElement classC = ElementFactory.classElement("C", classB.type, []); |
| 571 JUnitTestCase.assertEquals(1, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classA.type)); | 637 JUnitTestCase.assertEquals(1, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classA.type)); |
| 572 JUnitTestCase.assertEquals(2, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classB.type)); | 638 JUnitTestCase.assertEquals(2, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classB.type)); |
| 573 JUnitTestCase.assertEquals(3, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classC.type)); | 639 JUnitTestCase.assertEquals(3, InterfaceTypeImpl.computeLongestInheritancePat
hToObject(classC.type)); |
| 574 } | 640 } |
| 575 | 641 |
| 576 void test_computeSuperinterfaceSet_multipleInterfacePaths() { | 642 void test_computeSuperinterfaceSet_multipleInterfacePaths() { |
| 577 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 643 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 578 ClassElementImpl classB = ElementFactory.classElement2("B", []); | 644 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 579 ClassElementImpl classC = ElementFactory.classElement2("C", []); | 645 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
| 580 ClassElementImpl classD = ElementFactory.classElement2("D", []); | 646 ClassElementImpl classD = ElementFactory.classElement2("D", []); |
| 581 ClassElementImpl classE = ElementFactory.classElement2("E", []); | 647 ClassElementImpl classE = ElementFactory.classElement2("E", []); |
| 582 classB.interfaces = <InterfaceType> [classA.type]; | 648 classB.interfaces = <InterfaceType> [classA.type]; |
| 583 classC.interfaces = <InterfaceType> [classA.type]; | 649 classC.interfaces = <InterfaceType> [classA.type]; |
| 584 classD.interfaces = <InterfaceType> [classC.type]; | 650 classD.interfaces = <InterfaceType> [classC.type]; |
| 585 classE.interfaces = <InterfaceType> [classB.type, classD.type]; | 651 classE.interfaces = <InterfaceType> [classB.type, classD.type]; |
| 652 // D |
| 586 Set<InterfaceType> superinterfacesOfD = InterfaceTypeImpl.computeSuperinterf
aceSet(classD.type); | 653 Set<InterfaceType> superinterfacesOfD = InterfaceTypeImpl.computeSuperinterf
aceSet(classD.type); |
| 587 EngineTestCase.assertSize3(3, superinterfacesOfD); | 654 EngineTestCase.assertSize3(3, superinterfacesOfD); |
| 588 JUnitTestCase.assertTrue(superinterfacesOfD.contains(ElementFactory.object.t
ype)); | 655 JUnitTestCase.assertTrue(superinterfacesOfD.contains(ElementFactory.object.t
ype)); |
| 589 JUnitTestCase.assertTrue(superinterfacesOfD.contains(classA.type)); | 656 JUnitTestCase.assertTrue(superinterfacesOfD.contains(classA.type)); |
| 590 JUnitTestCase.assertTrue(superinterfacesOfD.contains(classC.type)); | 657 JUnitTestCase.assertTrue(superinterfacesOfD.contains(classC.type)); |
| 658 // E |
| 591 Set<InterfaceType> superinterfacesOfE = InterfaceTypeImpl.computeSuperinterf
aceSet(classE.type); | 659 Set<InterfaceType> superinterfacesOfE = InterfaceTypeImpl.computeSuperinterf
aceSet(classE.type); |
| 592 EngineTestCase.assertSize3(5, superinterfacesOfE); | 660 EngineTestCase.assertSize3(5, superinterfacesOfE); |
| 593 JUnitTestCase.assertTrue(superinterfacesOfE.contains(ElementFactory.object.t
ype)); | 661 JUnitTestCase.assertTrue(superinterfacesOfE.contains(ElementFactory.object.t
ype)); |
| 594 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classA.type)); | 662 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classA.type)); |
| 595 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classB.type)); | 663 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classB.type)); |
| 596 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classC.type)); | 664 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classC.type)); |
| 597 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classD.type)); | 665 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classD.type)); |
| 598 } | 666 } |
| 599 | 667 |
| 600 void test_computeSuperinterfaceSet_multipleSuperclassPaths() { | 668 void test_computeSuperinterfaceSet_multipleSuperclassPaths() { |
| 601 ClassElement classA = ElementFactory.classElement2("A", []); | 669 ClassElement classA = ElementFactory.classElement2("A", []); |
| 602 ClassElement classB = ElementFactory.classElement("B", classA.type, []); | 670 ClassElement classB = ElementFactory.classElement("B", classA.type, []); |
| 603 ClassElement classC = ElementFactory.classElement("C", classA.type, []); | 671 ClassElement classC = ElementFactory.classElement("C", classA.type, []); |
| 604 ClassElement classD = ElementFactory.classElement("D", classC.type, []); | 672 ClassElement classD = ElementFactory.classElement("D", classC.type, []); |
| 605 ClassElementImpl classE = ElementFactory.classElement("E", classB.type, []); | 673 ClassElementImpl classE = ElementFactory.classElement("E", classB.type, []); |
| 606 classE.interfaces = <InterfaceType> [classD.type]; | 674 classE.interfaces = <InterfaceType> [classD.type]; |
| 675 // D |
| 607 Set<InterfaceType> superinterfacesOfD = InterfaceTypeImpl.computeSuperinterf
aceSet(classD.type); | 676 Set<InterfaceType> superinterfacesOfD = InterfaceTypeImpl.computeSuperinterf
aceSet(classD.type); |
| 608 EngineTestCase.assertSize3(3, superinterfacesOfD); | 677 EngineTestCase.assertSize3(3, superinterfacesOfD); |
| 609 JUnitTestCase.assertTrue(superinterfacesOfD.contains(ElementFactory.object.t
ype)); | 678 JUnitTestCase.assertTrue(superinterfacesOfD.contains(ElementFactory.object.t
ype)); |
| 610 JUnitTestCase.assertTrue(superinterfacesOfD.contains(classA.type)); | 679 JUnitTestCase.assertTrue(superinterfacesOfD.contains(classA.type)); |
| 611 JUnitTestCase.assertTrue(superinterfacesOfD.contains(classC.type)); | 680 JUnitTestCase.assertTrue(superinterfacesOfD.contains(classC.type)); |
| 681 // E |
| 612 Set<InterfaceType> superinterfacesOfE = InterfaceTypeImpl.computeSuperinterf
aceSet(classE.type); | 682 Set<InterfaceType> superinterfacesOfE = InterfaceTypeImpl.computeSuperinterf
aceSet(classE.type); |
| 613 EngineTestCase.assertSize3(5, superinterfacesOfE); | 683 EngineTestCase.assertSize3(5, superinterfacesOfE); |
| 614 JUnitTestCase.assertTrue(superinterfacesOfE.contains(ElementFactory.object.t
ype)); | 684 JUnitTestCase.assertTrue(superinterfacesOfE.contains(ElementFactory.object.t
ype)); |
| 615 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classA.type)); | 685 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classA.type)); |
| 616 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classB.type)); | 686 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classB.type)); |
| 617 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classC.type)); | 687 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classC.type)); |
| 618 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classD.type)); | 688 JUnitTestCase.assertTrue(superinterfacesOfE.contains(classD.type)); |
| 619 } | 689 } |
| 620 | 690 |
| 621 void test_computeSuperinterfaceSet_recursion() { | 691 void test_computeSuperinterfaceSet_recursion() { |
| 622 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 692 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 623 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 693 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 624 classA.supertype = classB.type; | 694 classA.supertype = classB.type; |
| 625 Set<InterfaceType> superinterfacesOfB = InterfaceTypeImpl.computeSuperinterf
aceSet(classB.type); | 695 Set<InterfaceType> superinterfacesOfB = InterfaceTypeImpl.computeSuperinterf
aceSet(classB.type); |
| 626 EngineTestCase.assertSize3(2, superinterfacesOfB); | 696 EngineTestCase.assertSize3(2, superinterfacesOfB); |
| 627 } | 697 } |
| 628 | 698 |
| 629 void test_computeSuperinterfaceSet_singleInterfacePath() { | 699 void test_computeSuperinterfaceSet_singleInterfacePath() { |
| 630 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 700 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 631 ClassElementImpl classB = ElementFactory.classElement2("B", []); | 701 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 632 ClassElementImpl classC = ElementFactory.classElement2("C", []); | 702 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
| 633 classB.interfaces = <InterfaceType> [classA.type]; | 703 classB.interfaces = <InterfaceType> [classA.type]; |
| 634 classC.interfaces = <InterfaceType> [classB.type]; | 704 classC.interfaces = <InterfaceType> [classB.type]; |
| 705 // A |
| 635 Set<InterfaceType> superinterfacesOfA = InterfaceTypeImpl.computeSuperinterf
aceSet(classA.type); | 706 Set<InterfaceType> superinterfacesOfA = InterfaceTypeImpl.computeSuperinterf
aceSet(classA.type); |
| 636 EngineTestCase.assertSize3(1, superinterfacesOfA); | 707 EngineTestCase.assertSize3(1, superinterfacesOfA); |
| 637 JUnitTestCase.assertTrue(superinterfacesOfA.contains(ElementFactory.object.t
ype)); | 708 JUnitTestCase.assertTrue(superinterfacesOfA.contains(ElementFactory.object.t
ype)); |
| 709 // B |
| 638 Set<InterfaceType> superinterfacesOfB = InterfaceTypeImpl.computeSuperinterf
aceSet(classB.type); | 710 Set<InterfaceType> superinterfacesOfB = InterfaceTypeImpl.computeSuperinterf
aceSet(classB.type); |
| 639 EngineTestCase.assertSize3(2, superinterfacesOfB); | 711 EngineTestCase.assertSize3(2, superinterfacesOfB); |
| 640 JUnitTestCase.assertTrue(superinterfacesOfB.contains(ElementFactory.object.t
ype)); | 712 JUnitTestCase.assertTrue(superinterfacesOfB.contains(ElementFactory.object.t
ype)); |
| 641 JUnitTestCase.assertTrue(superinterfacesOfB.contains(classA.type)); | 713 JUnitTestCase.assertTrue(superinterfacesOfB.contains(classA.type)); |
| 714 // C |
| 642 Set<InterfaceType> superinterfacesOfC = InterfaceTypeImpl.computeSuperinterf
aceSet(classC.type); | 715 Set<InterfaceType> superinterfacesOfC = InterfaceTypeImpl.computeSuperinterf
aceSet(classC.type); |
| 643 EngineTestCase.assertSize3(3, superinterfacesOfC); | 716 EngineTestCase.assertSize3(3, superinterfacesOfC); |
| 644 JUnitTestCase.assertTrue(superinterfacesOfC.contains(ElementFactory.object.t
ype)); | 717 JUnitTestCase.assertTrue(superinterfacesOfC.contains(ElementFactory.object.t
ype)); |
| 645 JUnitTestCase.assertTrue(superinterfacesOfC.contains(classA.type)); | 718 JUnitTestCase.assertTrue(superinterfacesOfC.contains(classA.type)); |
| 646 JUnitTestCase.assertTrue(superinterfacesOfC.contains(classB.type)); | 719 JUnitTestCase.assertTrue(superinterfacesOfC.contains(classB.type)); |
| 647 } | 720 } |
| 648 | 721 |
| 649 void test_computeSuperinterfaceSet_singleSuperclassPath() { | 722 void test_computeSuperinterfaceSet_singleSuperclassPath() { |
| 723 // |
| 724 // A |
| 725 // | |
| 726 // B |
| 727 // | |
| 728 // C |
| 729 // |
| 650 ClassElement classA = ElementFactory.classElement2("A", []); | 730 ClassElement classA = ElementFactory.classElement2("A", []); |
| 651 ClassElement classB = ElementFactory.classElement("B", classA.type, []); | 731 ClassElement classB = ElementFactory.classElement("B", classA.type, []); |
| 652 ClassElement classC = ElementFactory.classElement("C", classB.type, []); | 732 ClassElement classC = ElementFactory.classElement("C", classB.type, []); |
| 733 // A |
| 653 Set<InterfaceType> superinterfacesOfA = InterfaceTypeImpl.computeSuperinterf
aceSet(classA.type); | 734 Set<InterfaceType> superinterfacesOfA = InterfaceTypeImpl.computeSuperinterf
aceSet(classA.type); |
| 654 EngineTestCase.assertSize3(1, superinterfacesOfA); | 735 EngineTestCase.assertSize3(1, superinterfacesOfA); |
| 655 JUnitTestCase.assertTrue(superinterfacesOfA.contains(ElementFactory.object.t
ype)); | 736 JUnitTestCase.assertTrue(superinterfacesOfA.contains(ElementFactory.object.t
ype)); |
| 737 // B |
| 656 Set<InterfaceType> superinterfacesOfB = InterfaceTypeImpl.computeSuperinterf
aceSet(classB.type); | 738 Set<InterfaceType> superinterfacesOfB = InterfaceTypeImpl.computeSuperinterf
aceSet(classB.type); |
| 657 EngineTestCase.assertSize3(2, superinterfacesOfB); | 739 EngineTestCase.assertSize3(2, superinterfacesOfB); |
| 658 JUnitTestCase.assertTrue(superinterfacesOfB.contains(ElementFactory.object.t
ype)); | 740 JUnitTestCase.assertTrue(superinterfacesOfB.contains(ElementFactory.object.t
ype)); |
| 659 JUnitTestCase.assertTrue(superinterfacesOfB.contains(classA.type)); | 741 JUnitTestCase.assertTrue(superinterfacesOfB.contains(classA.type)); |
| 742 // C |
| 660 Set<InterfaceType> superinterfacesOfC = InterfaceTypeImpl.computeSuperinterf
aceSet(classC.type); | 743 Set<InterfaceType> superinterfacesOfC = InterfaceTypeImpl.computeSuperinterf
aceSet(classC.type); |
| 661 EngineTestCase.assertSize3(3, superinterfacesOfC); | 744 EngineTestCase.assertSize3(3, superinterfacesOfC); |
| 662 JUnitTestCase.assertTrue(superinterfacesOfC.contains(ElementFactory.object.t
ype)); | 745 JUnitTestCase.assertTrue(superinterfacesOfC.contains(ElementFactory.object.t
ype)); |
| 663 JUnitTestCase.assertTrue(superinterfacesOfC.contains(classA.type)); | 746 JUnitTestCase.assertTrue(superinterfacesOfC.contains(classA.type)); |
| 664 JUnitTestCase.assertTrue(superinterfacesOfC.contains(classB.type)); | 747 JUnitTestCase.assertTrue(superinterfacesOfC.contains(classB.type)); |
| 665 } | 748 } |
| 666 | 749 |
| 667 void test_creation() { | 750 void test_creation() { |
| 668 JUnitTestCase.assertNotNull(new InterfaceTypeImpl.con1(ElementFactory.classE
lement2("A", []))); | 751 JUnitTestCase.assertNotNull(new InterfaceTypeImpl.con1(ElementFactory.classE
lement2("A", []))); |
| 669 } | 752 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 683 JUnitTestCase.assertEquals(0, type.accessors.length); | 766 JUnitTestCase.assertEquals(0, type.accessors.length); |
| 684 } | 767 } |
| 685 | 768 |
| 686 void test_getElement() { | 769 void test_getElement() { |
| 687 ClassElementImpl typeElement = ElementFactory.classElement2("A", []); | 770 ClassElementImpl typeElement = ElementFactory.classElement2("A", []); |
| 688 InterfaceTypeImpl type = new InterfaceTypeImpl.con1(typeElement); | 771 InterfaceTypeImpl type = new InterfaceTypeImpl.con1(typeElement); |
| 689 JUnitTestCase.assertEquals(typeElement, type.element); | 772 JUnitTestCase.assertEquals(typeElement, type.element); |
| 690 } | 773 } |
| 691 | 774 |
| 692 void test_getGetter_implemented() { | 775 void test_getGetter_implemented() { |
| 776 // |
| 777 // class A { g {} } |
| 778 // |
| 693 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 779 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 694 String getterName = "g"; | 780 String getterName = "g"; |
| 695 PropertyAccessorElement getterG = ElementFactory.getterElement(getterName, f
alse, null); | 781 PropertyAccessorElement getterG = ElementFactory.getterElement(getterName, f
alse, null); |
| 696 classA.accessors = <PropertyAccessorElement> [getterG]; | 782 classA.accessors = <PropertyAccessorElement> [getterG]; |
| 697 InterfaceType typeA = classA.type; | 783 InterfaceType typeA = classA.type; |
| 698 JUnitTestCase.assertSame(getterG, typeA.getGetter(getterName)); | 784 JUnitTestCase.assertSame(getterG, typeA.getGetter(getterName)); |
| 699 } | 785 } |
| 700 | 786 |
| 701 void test_getGetter_parameterized() { | 787 void test_getGetter_parameterized() { |
| 788 // |
| 789 // class A<E> { E get g {} } |
| 790 // |
| 702 ClassElementImpl classA = ElementFactory.classElement2("A", ["E"]); | 791 ClassElementImpl classA = ElementFactory.classElement2("A", ["E"]); |
| 703 Type2 typeE = classA.type.typeArguments[0]; | 792 Type2 typeE = classA.type.typeArguments[0]; |
| 704 String getterName = "g"; | 793 String getterName = "g"; |
| 705 PropertyAccessorElement getterG = ElementFactory.getterElement(getterName, f
alse, typeE); | 794 PropertyAccessorElement getterG = ElementFactory.getterElement(getterName, f
alse, typeE); |
| 706 classA.accessors = <PropertyAccessorElement> [getterG]; | 795 classA.accessors = <PropertyAccessorElement> [getterG]; |
| 707 (getterG.type as FunctionTypeImpl).typeArguments = classA.type.typeArguments
; | 796 (getterG.type as FunctionTypeImpl).typeArguments = classA.type.typeArguments
; |
| 797 // |
| 798 // A<I> |
| 799 // |
| 708 InterfaceType typeI = ElementFactory.classElement2("I", []).type; | 800 InterfaceType typeI = ElementFactory.classElement2("I", []).type; |
| 709 InterfaceTypeImpl typeAI = new InterfaceTypeImpl.con1(classA); | 801 InterfaceTypeImpl typeAI = new InterfaceTypeImpl.con1(classA); |
| 710 typeAI.typeArguments = <Type2> [typeI]; | 802 typeAI.typeArguments = <Type2> [typeI]; |
| 711 PropertyAccessorElement getter = typeAI.getGetter(getterName); | 803 PropertyAccessorElement getter = typeAI.getGetter(getterName); |
| 712 JUnitTestCase.assertNotNull(getter); | 804 JUnitTestCase.assertNotNull(getter); |
| 713 FunctionType getterType = getter.type; | 805 FunctionType getterType = getter.type; |
| 714 JUnitTestCase.assertSame(typeI, getterType.returnType); | 806 JUnitTestCase.assertSame(typeI, getterType.returnType); |
| 715 } | 807 } |
| 716 | 808 |
| 717 void test_getGetter_unimplemented() { | 809 void test_getGetter_unimplemented() { |
| 810 // |
| 811 // class A {} |
| 812 // |
| 718 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 813 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 719 InterfaceType typeA = classA.type; | 814 InterfaceType typeA = classA.type; |
| 720 JUnitTestCase.assertNull(typeA.getGetter("g")); | 815 JUnitTestCase.assertNull(typeA.getGetter("g")); |
| 721 } | 816 } |
| 722 | 817 |
| 723 void test_getInterfaces_nonParameterized() { | 818 void test_getInterfaces_nonParameterized() { |
| 819 // |
| 820 // class C implements A, B |
| 821 // |
| 724 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 822 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 725 InterfaceType typeA = classA.type; | 823 InterfaceType typeA = classA.type; |
| 726 ClassElementImpl classB = ElementFactory.classElement2("B", []); | 824 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 727 InterfaceType typeB = classB.type; | 825 InterfaceType typeB = classB.type; |
| 728 ClassElementImpl classC = ElementFactory.classElement2("C", []); | 826 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
| 729 classC.interfaces = <InterfaceType> [typeA, typeB]; | 827 classC.interfaces = <InterfaceType> [typeA, typeB]; |
| 730 List<InterfaceType> interfaces = classC.type.interfaces; | 828 List<InterfaceType> interfaces = classC.type.interfaces; |
| 731 EngineTestCase.assertLength(2, interfaces); | 829 EngineTestCase.assertLength(2, interfaces); |
| 732 if (identical(interfaces[0], typeA)) { | 830 if (identical(interfaces[0], typeA)) { |
| 733 JUnitTestCase.assertSame(typeB, interfaces[1]); | 831 JUnitTestCase.assertSame(typeB, interfaces[1]); |
| 734 } else { | 832 } else { |
| 735 JUnitTestCase.assertSame(typeB, interfaces[0]); | 833 JUnitTestCase.assertSame(typeB, interfaces[0]); |
| 736 JUnitTestCase.assertSame(typeA, interfaces[1]); | 834 JUnitTestCase.assertSame(typeA, interfaces[1]); |
| 737 } | 835 } |
| 738 } | 836 } |
| 739 | 837 |
| 740 void test_getInterfaces_parameterized() { | 838 void test_getInterfaces_parameterized() { |
| 839 // |
| 840 // class A<E> |
| 841 // class B<F> implements A<F> |
| 842 // |
| 741 ClassElementImpl classA = ElementFactory.classElement2("A", ["E"]); | 843 ClassElementImpl classA = ElementFactory.classElement2("A", ["E"]); |
| 742 ClassElementImpl classB = ElementFactory.classElement2("B", ["F"]); | 844 ClassElementImpl classB = ElementFactory.classElement2("B", ["F"]); |
| 743 InterfaceType typeB = classB.type; | 845 InterfaceType typeB = classB.type; |
| 744 InterfaceTypeImpl typeAF = new InterfaceTypeImpl.con1(classA); | 846 InterfaceTypeImpl typeAF = new InterfaceTypeImpl.con1(classA); |
| 745 typeAF.typeArguments = <Type2> [typeB.typeArguments[0]]; | 847 typeAF.typeArguments = <Type2> [typeB.typeArguments[0]]; |
| 746 classB.interfaces = <InterfaceType> [typeAF]; | 848 classB.interfaces = <InterfaceType> [typeAF]; |
| 849 // |
| 850 // B<I> |
| 851 // |
| 747 InterfaceType typeI = ElementFactory.classElement2("I", []).type; | 852 InterfaceType typeI = ElementFactory.classElement2("I", []).type; |
| 748 InterfaceTypeImpl typeBI = new InterfaceTypeImpl.con1(classB); | 853 InterfaceTypeImpl typeBI = new InterfaceTypeImpl.con1(classB); |
| 749 typeBI.typeArguments = <Type2> [typeI]; | 854 typeBI.typeArguments = <Type2> [typeI]; |
| 750 List<InterfaceType> interfaces = typeBI.interfaces; | 855 List<InterfaceType> interfaces = typeBI.interfaces; |
| 751 EngineTestCase.assertLength(1, interfaces); | 856 EngineTestCase.assertLength(1, interfaces); |
| 752 InterfaceType result = interfaces[0]; | 857 InterfaceType result = interfaces[0]; |
| 753 JUnitTestCase.assertSame(classA, result.element); | 858 JUnitTestCase.assertSame(classA, result.element); |
| 754 JUnitTestCase.assertSame(typeI, result.typeArguments[0]); | 859 JUnitTestCase.assertSame(typeI, result.typeArguments[0]); |
| 755 } | 860 } |
| 756 | 861 |
| 757 void test_getLeastUpperBound_directInterfaceCase() { | 862 void test_getLeastUpperBound_directInterfaceCase() { |
| 863 // |
| 864 // class A |
| 865 // class B implements A |
| 866 // class C implements B |
| 867 // |
| 758 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 868 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 759 ClassElementImpl classB = ElementFactory.classElement2("B", []); | 869 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 760 ClassElementImpl classC = ElementFactory.classElement2("C", []); | 870 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
| 761 InterfaceType typeA = classA.type; | 871 InterfaceType typeA = classA.type; |
| 762 InterfaceType typeB = classB.type; | 872 InterfaceType typeB = classB.type; |
| 763 InterfaceType typeC = classC.type; | 873 InterfaceType typeC = classC.type; |
| 764 classB.interfaces = <InterfaceType> [typeA]; | 874 classB.interfaces = <InterfaceType> [typeA]; |
| 765 classC.interfaces = <InterfaceType> [typeB]; | 875 classC.interfaces = <InterfaceType> [typeB]; |
| 766 JUnitTestCase.assertEquals(typeB, typeB.getLeastUpperBound(typeC)); | 876 JUnitTestCase.assertEquals(typeB, typeB.getLeastUpperBound(typeC)); |
| 767 JUnitTestCase.assertEquals(typeB, typeC.getLeastUpperBound(typeB)); | 877 JUnitTestCase.assertEquals(typeB, typeC.getLeastUpperBound(typeB)); |
| 768 } | 878 } |
| 769 | 879 |
| 770 void test_getLeastUpperBound_directSubclassCase() { | 880 void test_getLeastUpperBound_directSubclassCase() { |
| 881 // |
| 882 // class A |
| 883 // class B extends A |
| 884 // class C extends B |
| 885 // |
| 771 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 886 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 772 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 887 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 773 ClassElementImpl classC = ElementFactory.classElement("C", classB.type, []); | 888 ClassElementImpl classC = ElementFactory.classElement("C", classB.type, []); |
| 774 InterfaceType typeB = classB.type; | 889 InterfaceType typeB = classB.type; |
| 775 InterfaceType typeC = classC.type; | 890 InterfaceType typeC = classC.type; |
| 776 JUnitTestCase.assertEquals(typeB, typeB.getLeastUpperBound(typeC)); | 891 JUnitTestCase.assertEquals(typeB, typeB.getLeastUpperBound(typeC)); |
| 777 JUnitTestCase.assertEquals(typeB, typeC.getLeastUpperBound(typeB)); | 892 JUnitTestCase.assertEquals(typeB, typeC.getLeastUpperBound(typeB)); |
| 778 } | 893 } |
| 779 | 894 |
| 780 void test_getLeastUpperBound_functionType() { | 895 void test_getLeastUpperBound_functionType() { |
| 781 Type2 interfaceType = ElementFactory.classElement2("A", []).type; | 896 Type2 interfaceType = ElementFactory.classElement2("A", []).type; |
| 782 FunctionTypeImpl functionType = new FunctionTypeImpl.con1(new FunctionElemen
tImpl.con1(ASTFactory.identifier3("f"))); | 897 FunctionTypeImpl functionType = new FunctionTypeImpl.con1(new FunctionElemen
tImpl.con1(ASTFactory.identifier3("f"))); |
| 783 JUnitTestCase.assertNull(interfaceType.getLeastUpperBound(functionType)); | 898 JUnitTestCase.assertNull(interfaceType.getLeastUpperBound(functionType)); |
| 784 } | 899 } |
| 785 | 900 |
| 786 void test_getLeastUpperBound_mixinCase() { | 901 void test_getLeastUpperBound_mixinCase() { |
| 902 // |
| 903 // class A |
| 904 // class B extends A |
| 905 // class C extends A |
| 906 // class D extends B with M, N, O, P |
| 907 // |
| 787 ClassElement classA = ElementFactory.classElement2("A", []); | 908 ClassElement classA = ElementFactory.classElement2("A", []); |
| 788 ClassElement classB = ElementFactory.classElement("B", classA.type, []); | 909 ClassElement classB = ElementFactory.classElement("B", classA.type, []); |
| 789 ClassElement classC = ElementFactory.classElement("C", classA.type, []); | 910 ClassElement classC = ElementFactory.classElement("C", classA.type, []); |
| 790 ClassElementImpl classD = ElementFactory.classElement("D", classB.type, []); | 911 ClassElementImpl classD = ElementFactory.classElement("D", classB.type, []); |
| 791 InterfaceType typeA = classA.type; | 912 InterfaceType typeA = classA.type; |
| 792 InterfaceType typeC = classC.type; | 913 InterfaceType typeC = classC.type; |
| 793 InterfaceType typeD = classD.type; | 914 InterfaceType typeD = classD.type; |
| 794 classD.mixins = <InterfaceType> [ | 915 classD.mixins = <InterfaceType> [ |
| 795 ElementFactory.classElement2("M", []).type, | 916 ElementFactory.classElement2("M", []).type, |
| 796 ElementFactory.classElement2("N", []).type, | 917 ElementFactory.classElement2("N", []).type, |
| 797 ElementFactory.classElement2("O", []).type, | 918 ElementFactory.classElement2("O", []).type, |
| 798 ElementFactory.classElement2("P", []).type]; | 919 ElementFactory.classElement2("P", []).type]; |
| 799 JUnitTestCase.assertEquals(typeA, typeD.getLeastUpperBound(typeC)); | 920 JUnitTestCase.assertEquals(typeA, typeD.getLeastUpperBound(typeC)); |
| 800 JUnitTestCase.assertEquals(typeA, typeC.getLeastUpperBound(typeD)); | 921 JUnitTestCase.assertEquals(typeA, typeC.getLeastUpperBound(typeD)); |
| 801 } | 922 } |
| 802 | 923 |
| 803 void test_getLeastUpperBound_null() { | 924 void test_getLeastUpperBound_null() { |
| 804 Type2 interfaceType = ElementFactory.classElement2("A", []).type; | 925 Type2 interfaceType = ElementFactory.classElement2("A", []).type; |
| 805 JUnitTestCase.assertNull(interfaceType.getLeastUpperBound(null)); | 926 JUnitTestCase.assertNull(interfaceType.getLeastUpperBound(null)); |
| 806 } | 927 } |
| 807 | 928 |
| 808 void test_getLeastUpperBound_object() { | 929 void test_getLeastUpperBound_object() { |
| 809 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 930 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 810 ClassElementImpl classB = ElementFactory.classElement2("B", []); | 931 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 811 InterfaceType typeA = classA.type; | 932 InterfaceType typeA = classA.type; |
| 812 InterfaceType typeB = classB.type; | 933 InterfaceType typeB = classB.type; |
| 813 Type2 typeObject = typeA.element.supertype; | 934 Type2 typeObject = typeA.element.supertype; |
| 935 // assert that object does not have a super type |
| 814 JUnitTestCase.assertNull((typeObject.element as ClassElement).supertype); | 936 JUnitTestCase.assertNull((typeObject.element as ClassElement).supertype); |
| 937 // assert that both A and B have the same super type of Object |
| 815 JUnitTestCase.assertEquals(typeObject, typeB.element.supertype); | 938 JUnitTestCase.assertEquals(typeObject, typeB.element.supertype); |
| 939 // finally, assert that the only least upper bound of A and B is Object |
| 816 JUnitTestCase.assertEquals(typeObject, typeA.getLeastUpperBound(typeB)); | 940 JUnitTestCase.assertEquals(typeObject, typeA.getLeastUpperBound(typeB)); |
| 817 } | 941 } |
| 818 | 942 |
| 819 void test_getLeastUpperBound_self() { | 943 void test_getLeastUpperBound_self() { |
| 820 ClassElement classA = ElementFactory.classElement2("A", []); | 944 ClassElement classA = ElementFactory.classElement2("A", []); |
| 821 InterfaceType typeA = classA.type; | 945 InterfaceType typeA = classA.type; |
| 822 JUnitTestCase.assertEquals(typeA, typeA.getLeastUpperBound(typeA)); | 946 JUnitTestCase.assertEquals(typeA, typeA.getLeastUpperBound(typeA)); |
| 823 } | 947 } |
| 824 | 948 |
| 825 void test_getLeastUpperBound_sharedSuperclass1() { | 949 void test_getLeastUpperBound_sharedSuperclass1() { |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 936 JUnitTestCase.assertEquals(typeA, typeC.getLeastUpperBound(typeB)); | 1060 JUnitTestCase.assertEquals(typeA, typeC.getLeastUpperBound(typeB)); |
| 937 } | 1061 } |
| 938 | 1062 |
| 939 void test_getLeastUpperBound_twoComparables() { | 1063 void test_getLeastUpperBound_twoComparables() { |
| 940 InterfaceType string = _typeProvider.stringType; | 1064 InterfaceType string = _typeProvider.stringType; |
| 941 InterfaceType num = _typeProvider.numType; | 1065 InterfaceType num = _typeProvider.numType; |
| 942 JUnitTestCase.assertEquals(_typeProvider.objectType, string.getLeastUpperBou
nd(num)); | 1066 JUnitTestCase.assertEquals(_typeProvider.objectType, string.getLeastUpperBou
nd(num)); |
| 943 } | 1067 } |
| 944 | 1068 |
| 945 void test_getLeastUpperBound_typeParameters_different() { | 1069 void test_getLeastUpperBound_typeParameters_different() { |
| 1070 // |
| 1071 // class List<int> |
| 1072 // class List<double> |
| 1073 // |
| 946 InterfaceType listType = _typeProvider.listType; | 1074 InterfaceType listType = _typeProvider.listType; |
| 947 InterfaceType intType = _typeProvider.intType; | 1075 InterfaceType intType = _typeProvider.intType; |
| 948 InterfaceType doubleType = _typeProvider.doubleType; | 1076 InterfaceType doubleType = _typeProvider.doubleType; |
| 949 InterfaceType listOfIntType = listType.substitute4(<Type2> [intType]); | 1077 InterfaceType listOfIntType = listType.substitute4(<Type2> [intType]); |
| 950 InterfaceType listOfDoubleType = listType.substitute4(<Type2> [doubleType]); | 1078 InterfaceType listOfDoubleType = listType.substitute4(<Type2> [doubleType]); |
| 951 JUnitTestCase.assertEquals(listType.substitute4(<Type2> [_typeProvider.dynam
icType]), listOfIntType.getLeastUpperBound(listOfDoubleType)); | 1079 JUnitTestCase.assertEquals(listType.substitute4(<Type2> [_typeProvider.dynam
icType]), listOfIntType.getLeastUpperBound(listOfDoubleType)); |
| 952 } | 1080 } |
| 953 | 1081 |
| 954 void test_getLeastUpperBound_typeParameters_same() { | 1082 void test_getLeastUpperBound_typeParameters_same() { |
| 1083 // |
| 1084 // List<int> |
| 1085 // List<int> |
| 1086 // |
| 955 InterfaceType listType = _typeProvider.listType; | 1087 InterfaceType listType = _typeProvider.listType; |
| 956 InterfaceType intType = _typeProvider.intType; | 1088 InterfaceType intType = _typeProvider.intType; |
| 957 InterfaceType listOfIntType = listType.substitute4(<Type2> [intType]); | 1089 InterfaceType listOfIntType = listType.substitute4(<Type2> [intType]); |
| 958 JUnitTestCase.assertEquals(listOfIntType, listOfIntType.getLeastUpperBound(l
istOfIntType)); | 1090 JUnitTestCase.assertEquals(listOfIntType, listOfIntType.getLeastUpperBound(l
istOfIntType)); |
| 959 } | 1091 } |
| 960 | 1092 |
| 961 void test_getMethod_implemented() { | 1093 void test_getMethod_implemented() { |
| 1094 // |
| 1095 // class A { m() {} } |
| 1096 // |
| 962 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1097 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 963 String methodName = "m"; | 1098 String methodName = "m"; |
| 964 MethodElementImpl methodM = ElementFactory.methodElement(methodName, null, [
]); | 1099 MethodElementImpl methodM = ElementFactory.methodElement(methodName, null, [
]); |
| 965 classA.methods = <MethodElement> [methodM]; | 1100 classA.methods = <MethodElement> [methodM]; |
| 966 InterfaceType typeA = classA.type; | 1101 InterfaceType typeA = classA.type; |
| 967 JUnitTestCase.assertSame(methodM, typeA.getMethod(methodName)); | 1102 JUnitTestCase.assertSame(methodM, typeA.getMethod(methodName)); |
| 968 } | 1103 } |
| 969 | 1104 |
| 970 void test_getMethod_parameterized() { | 1105 void test_getMethod_parameterized() { |
| 1106 // |
| 1107 // class A<E> { E m(E p) {} } |
| 1108 // |
| 971 ClassElementImpl classA = ElementFactory.classElement2("A", ["E"]); | 1109 ClassElementImpl classA = ElementFactory.classElement2("A", ["E"]); |
| 972 Type2 typeE = classA.type.typeArguments[0]; | 1110 Type2 typeE = classA.type.typeArguments[0]; |
| 973 String methodName = "m"; | 1111 String methodName = "m"; |
| 974 MethodElementImpl methodM = ElementFactory.methodElement(methodName, typeE,
[typeE]); | 1112 MethodElementImpl methodM = ElementFactory.methodElement(methodName, typeE,
[typeE]); |
| 975 classA.methods = <MethodElement> [methodM]; | 1113 classA.methods = <MethodElement> [methodM]; |
| 976 (methodM.type as FunctionTypeImpl).typeArguments = classA.type.typeArguments
; | 1114 (methodM.type as FunctionTypeImpl).typeArguments = classA.type.typeArguments
; |
| 1115 // |
| 1116 // A<I> |
| 1117 // |
| 977 InterfaceType typeI = ElementFactory.classElement2("I", []).type; | 1118 InterfaceType typeI = ElementFactory.classElement2("I", []).type; |
| 978 InterfaceTypeImpl typeAI = new InterfaceTypeImpl.con1(classA); | 1119 InterfaceTypeImpl typeAI = new InterfaceTypeImpl.con1(classA); |
| 979 typeAI.typeArguments = <Type2> [typeI]; | 1120 typeAI.typeArguments = <Type2> [typeI]; |
| 980 MethodElement method = typeAI.getMethod(methodName); | 1121 MethodElement method = typeAI.getMethod(methodName); |
| 981 JUnitTestCase.assertNotNull(method); | 1122 JUnitTestCase.assertNotNull(method); |
| 982 FunctionType methodType = method.type; | 1123 FunctionType methodType = method.type; |
| 983 JUnitTestCase.assertSame(typeI, methodType.returnType); | 1124 JUnitTestCase.assertSame(typeI, methodType.returnType); |
| 984 List<Type2> parameterTypes = methodType.normalParameterTypes; | 1125 List<Type2> parameterTypes = methodType.normalParameterTypes; |
| 985 EngineTestCase.assertLength(1, parameterTypes); | 1126 EngineTestCase.assertLength(1, parameterTypes); |
| 986 JUnitTestCase.assertSame(typeI, parameterTypes[0]); | 1127 JUnitTestCase.assertSame(typeI, parameterTypes[0]); |
| 987 } | 1128 } |
| 988 | 1129 |
| 989 void test_getMethod_unimplemented() { | 1130 void test_getMethod_unimplemented() { |
| 1131 // |
| 1132 // class A {} |
| 1133 // |
| 990 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1134 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 991 InterfaceType typeA = classA.type; | 1135 InterfaceType typeA = classA.type; |
| 992 JUnitTestCase.assertNull(typeA.getMethod("m")); | 1136 JUnitTestCase.assertNull(typeA.getMethod("m")); |
| 993 } | 1137 } |
| 994 | 1138 |
| 995 void test_getMethods() { | 1139 void test_getMethods() { |
| 996 ClassElementImpl typeElement = ElementFactory.classElement2("A", []); | 1140 ClassElementImpl typeElement = ElementFactory.classElement2("A", []); |
| 997 MethodElementImpl methodOne = ElementFactory.methodElement("one", null, []); | 1141 MethodElementImpl methodOne = ElementFactory.methodElement("one", null, []); |
| 998 MethodElementImpl methodTwo = ElementFactory.methodElement("two", null, []); | 1142 MethodElementImpl methodTwo = ElementFactory.methodElement("two", null, []); |
| 999 typeElement.methods = <MethodElement> [methodOne, methodTwo]; | 1143 typeElement.methods = <MethodElement> [methodOne, methodTwo]; |
| 1000 InterfaceTypeImpl type = new InterfaceTypeImpl.con1(typeElement); | 1144 InterfaceTypeImpl type = new InterfaceTypeImpl.con1(typeElement); |
| 1001 JUnitTestCase.assertEquals(2, type.methods.length); | 1145 JUnitTestCase.assertEquals(2, type.methods.length); |
| 1002 } | 1146 } |
| 1003 | 1147 |
| 1004 void test_getMethods_empty() { | 1148 void test_getMethods_empty() { |
| 1005 ClassElementImpl typeElement = ElementFactory.classElement2("A", []); | 1149 ClassElementImpl typeElement = ElementFactory.classElement2("A", []); |
| 1006 InterfaceTypeImpl type = new InterfaceTypeImpl.con1(typeElement); | 1150 InterfaceTypeImpl type = new InterfaceTypeImpl.con1(typeElement); |
| 1007 JUnitTestCase.assertEquals(0, type.methods.length); | 1151 JUnitTestCase.assertEquals(0, type.methods.length); |
| 1008 } | 1152 } |
| 1009 | 1153 |
| 1010 void test_getMixins_nonParameterized() { | 1154 void test_getMixins_nonParameterized() { |
| 1155 // |
| 1156 // class C extends Object with A, B |
| 1157 // |
| 1011 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1158 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1012 InterfaceType typeA = classA.type; | 1159 InterfaceType typeA = classA.type; |
| 1013 ClassElementImpl classB = ElementFactory.classElement2("B", []); | 1160 ClassElementImpl classB = ElementFactory.classElement2("B", []); |
| 1014 InterfaceType typeB = classB.type; | 1161 InterfaceType typeB = classB.type; |
| 1015 ClassElementImpl classC = ElementFactory.classElement2("C", []); | 1162 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
| 1016 classC.mixins = <InterfaceType> [typeA, typeB]; | 1163 classC.mixins = <InterfaceType> [typeA, typeB]; |
| 1017 List<InterfaceType> interfaces = classC.type.mixins; | 1164 List<InterfaceType> interfaces = classC.type.mixins; |
| 1018 EngineTestCase.assertLength(2, interfaces); | 1165 EngineTestCase.assertLength(2, interfaces); |
| 1019 if (identical(interfaces[0], typeA)) { | 1166 if (identical(interfaces[0], typeA)) { |
| 1020 JUnitTestCase.assertSame(typeB, interfaces[1]); | 1167 JUnitTestCase.assertSame(typeB, interfaces[1]); |
| 1021 } else { | 1168 } else { |
| 1022 JUnitTestCase.assertSame(typeB, interfaces[0]); | 1169 JUnitTestCase.assertSame(typeB, interfaces[0]); |
| 1023 JUnitTestCase.assertSame(typeA, interfaces[1]); | 1170 JUnitTestCase.assertSame(typeA, interfaces[1]); |
| 1024 } | 1171 } |
| 1025 } | 1172 } |
| 1026 | 1173 |
| 1027 void test_getMixins_parameterized() { | 1174 void test_getMixins_parameterized() { |
| 1175 // |
| 1176 // class A<E> |
| 1177 // class B<F> extends Object with A<F> |
| 1178 // |
| 1028 ClassElementImpl classA = ElementFactory.classElement2("A", ["E"]); | 1179 ClassElementImpl classA = ElementFactory.classElement2("A", ["E"]); |
| 1029 ClassElementImpl classB = ElementFactory.classElement2("B", ["F"]); | 1180 ClassElementImpl classB = ElementFactory.classElement2("B", ["F"]); |
| 1030 InterfaceType typeB = classB.type; | 1181 InterfaceType typeB = classB.type; |
| 1031 InterfaceTypeImpl typeAF = new InterfaceTypeImpl.con1(classA); | 1182 InterfaceTypeImpl typeAF = new InterfaceTypeImpl.con1(classA); |
| 1032 typeAF.typeArguments = <Type2> [typeB.typeArguments[0]]; | 1183 typeAF.typeArguments = <Type2> [typeB.typeArguments[0]]; |
| 1033 classB.mixins = <InterfaceType> [typeAF]; | 1184 classB.mixins = <InterfaceType> [typeAF]; |
| 1185 // |
| 1186 // B<I> |
| 1187 // |
| 1034 InterfaceType typeI = ElementFactory.classElement2("I", []).type; | 1188 InterfaceType typeI = ElementFactory.classElement2("I", []).type; |
| 1035 InterfaceTypeImpl typeBI = new InterfaceTypeImpl.con1(classB); | 1189 InterfaceTypeImpl typeBI = new InterfaceTypeImpl.con1(classB); |
| 1036 typeBI.typeArguments = <Type2> [typeI]; | 1190 typeBI.typeArguments = <Type2> [typeI]; |
| 1037 List<InterfaceType> interfaces = typeBI.mixins; | 1191 List<InterfaceType> interfaces = typeBI.mixins; |
| 1038 EngineTestCase.assertLength(1, interfaces); | 1192 EngineTestCase.assertLength(1, interfaces); |
| 1039 InterfaceType result = interfaces[0]; | 1193 InterfaceType result = interfaces[0]; |
| 1040 JUnitTestCase.assertSame(classA, result.element); | 1194 JUnitTestCase.assertSame(classA, result.element); |
| 1041 JUnitTestCase.assertSame(typeI, result.typeArguments[0]); | 1195 JUnitTestCase.assertSame(typeI, result.typeArguments[0]); |
| 1042 } | 1196 } |
| 1043 | 1197 |
| 1044 void test_getSetter_implemented() { | 1198 void test_getSetter_implemented() { |
| 1199 // |
| 1200 // class A { s() {} } |
| 1201 // |
| 1045 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1202 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1046 String setterName = "s"; | 1203 String setterName = "s"; |
| 1047 PropertyAccessorElement setterS = ElementFactory.setterElement(setterName, f
alse, null); | 1204 PropertyAccessorElement setterS = ElementFactory.setterElement(setterName, f
alse, null); |
| 1048 classA.accessors = <PropertyAccessorElement> [setterS]; | 1205 classA.accessors = <PropertyAccessorElement> [setterS]; |
| 1049 InterfaceType typeA = classA.type; | 1206 InterfaceType typeA = classA.type; |
| 1050 JUnitTestCase.assertSame(setterS, typeA.getSetter(setterName)); | 1207 JUnitTestCase.assertSame(setterS, typeA.getSetter(setterName)); |
| 1051 } | 1208 } |
| 1052 | 1209 |
| 1053 void test_getSetter_parameterized() { | 1210 void test_getSetter_parameterized() { |
| 1211 // |
| 1212 // class A<E> { set s(E p) {} } |
| 1213 // |
| 1054 ClassElementImpl classA = ElementFactory.classElement2("A", ["E"]); | 1214 ClassElementImpl classA = ElementFactory.classElement2("A", ["E"]); |
| 1055 Type2 typeE = classA.type.typeArguments[0]; | 1215 Type2 typeE = classA.type.typeArguments[0]; |
| 1056 String setterName = "s"; | 1216 String setterName = "s"; |
| 1057 PropertyAccessorElement setterS = ElementFactory.setterElement(setterName, f
alse, typeE); | 1217 PropertyAccessorElement setterS = ElementFactory.setterElement(setterName, f
alse, typeE); |
| 1058 classA.accessors = <PropertyAccessorElement> [setterS]; | 1218 classA.accessors = <PropertyAccessorElement> [setterS]; |
| 1059 (setterS.type as FunctionTypeImpl).typeArguments = classA.type.typeArguments
; | 1219 (setterS.type as FunctionTypeImpl).typeArguments = classA.type.typeArguments
; |
| 1220 // |
| 1221 // A<I> |
| 1222 // |
| 1060 InterfaceType typeI = ElementFactory.classElement2("I", []).type; | 1223 InterfaceType typeI = ElementFactory.classElement2("I", []).type; |
| 1061 InterfaceTypeImpl typeAI = new InterfaceTypeImpl.con1(classA); | 1224 InterfaceTypeImpl typeAI = new InterfaceTypeImpl.con1(classA); |
| 1062 typeAI.typeArguments = <Type2> [typeI]; | 1225 typeAI.typeArguments = <Type2> [typeI]; |
| 1063 PropertyAccessorElement setter = typeAI.getSetter(setterName); | 1226 PropertyAccessorElement setter = typeAI.getSetter(setterName); |
| 1064 JUnitTestCase.assertNotNull(setter); | 1227 JUnitTestCase.assertNotNull(setter); |
| 1065 FunctionType setterType = setter.type; | 1228 FunctionType setterType = setter.type; |
| 1066 List<Type2> parameterTypes = setterType.normalParameterTypes; | 1229 List<Type2> parameterTypes = setterType.normalParameterTypes; |
| 1067 EngineTestCase.assertLength(1, parameterTypes); | 1230 EngineTestCase.assertLength(1, parameterTypes); |
| 1068 JUnitTestCase.assertSame(typeI, parameterTypes[0]); | 1231 JUnitTestCase.assertSame(typeI, parameterTypes[0]); |
| 1069 } | 1232 } |
| 1070 | 1233 |
| 1071 void test_getSetter_unimplemented() { | 1234 void test_getSetter_unimplemented() { |
| 1235 // |
| 1236 // class A {} |
| 1237 // |
| 1072 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1238 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1073 InterfaceType typeA = classA.type; | 1239 InterfaceType typeA = classA.type; |
| 1074 JUnitTestCase.assertNull(typeA.getSetter("s")); | 1240 JUnitTestCase.assertNull(typeA.getSetter("s")); |
| 1075 } | 1241 } |
| 1076 | 1242 |
| 1077 void test_getSuperclass_nonParameterized() { | 1243 void test_getSuperclass_nonParameterized() { |
| 1244 // |
| 1245 // class B extends A |
| 1246 // |
| 1078 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1247 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1079 InterfaceType typeA = classA.type; | 1248 InterfaceType typeA = classA.type; |
| 1080 ClassElementImpl classB = ElementFactory.classElement("B", typeA, []); | 1249 ClassElementImpl classB = ElementFactory.classElement("B", typeA, []); |
| 1081 InterfaceType typeB = classB.type; | 1250 InterfaceType typeB = classB.type; |
| 1082 JUnitTestCase.assertSame(typeA, typeB.superclass); | 1251 JUnitTestCase.assertSame(typeA, typeB.superclass); |
| 1083 } | 1252 } |
| 1084 | 1253 |
| 1085 void test_getSuperclass_parameterized() { | 1254 void test_getSuperclass_parameterized() { |
| 1255 // |
| 1256 // class A<E> |
| 1257 // class B<F> extends A<F> |
| 1258 // |
| 1086 ClassElementImpl classA = ElementFactory.classElement2("A", ["E"]); | 1259 ClassElementImpl classA = ElementFactory.classElement2("A", ["E"]); |
| 1087 ClassElementImpl classB = ElementFactory.classElement2("B", ["F"]); | 1260 ClassElementImpl classB = ElementFactory.classElement2("B", ["F"]); |
| 1088 InterfaceType typeB = classB.type; | 1261 InterfaceType typeB = classB.type; |
| 1089 InterfaceTypeImpl typeAF = new InterfaceTypeImpl.con1(classA); | 1262 InterfaceTypeImpl typeAF = new InterfaceTypeImpl.con1(classA); |
| 1090 typeAF.typeArguments = <Type2> [typeB.typeArguments[0]]; | 1263 typeAF.typeArguments = <Type2> [typeB.typeArguments[0]]; |
| 1091 classB.supertype = typeAF; | 1264 classB.supertype = typeAF; |
| 1265 // |
| 1266 // B<I> |
| 1267 // |
| 1092 InterfaceType typeI = ElementFactory.classElement2("I", []).type; | 1268 InterfaceType typeI = ElementFactory.classElement2("I", []).type; |
| 1093 InterfaceTypeImpl typeBI = new InterfaceTypeImpl.con1(classB); | 1269 InterfaceTypeImpl typeBI = new InterfaceTypeImpl.con1(classB); |
| 1094 typeBI.typeArguments = <Type2> [typeI]; | 1270 typeBI.typeArguments = <Type2> [typeI]; |
| 1095 InterfaceType superclass = typeBI.superclass; | 1271 InterfaceType superclass = typeBI.superclass; |
| 1096 JUnitTestCase.assertSame(classA, superclass.element); | 1272 JUnitTestCase.assertSame(classA, superclass.element); |
| 1097 JUnitTestCase.assertSame(typeI, superclass.typeArguments[0]); | 1273 JUnitTestCase.assertSame(typeI, superclass.typeArguments[0]); |
| 1098 } | 1274 } |
| 1099 | 1275 |
| 1100 void test_getTypeArguments_empty() { | 1276 void test_getTypeArguments_empty() { |
| 1101 InterfaceType type = ElementFactory.classElement2("A", []).type; | 1277 InterfaceType type = ElementFactory.classElement2("A", []).type; |
| 1102 EngineTestCase.assertLength(0, type.typeArguments); | 1278 EngineTestCase.assertLength(0, type.typeArguments); |
| 1103 } | 1279 } |
| 1104 | 1280 |
| 1105 void test_hashCode() { | 1281 void test_hashCode() { |
| 1106 ClassElement classA = ElementFactory.classElement2("A", []); | 1282 ClassElement classA = ElementFactory.classElement2("A", []); |
| 1107 InterfaceType typeA = classA.type; | 1283 InterfaceType typeA = classA.type; |
| 1108 JUnitTestCase.assertFalse(0 == typeA.hashCode); | 1284 JUnitTestCase.assertFalse(0 == typeA.hashCode); |
| 1109 } | 1285 } |
| 1110 | 1286 |
| 1111 void test_isAssignableTo_typeVariables() { | 1287 void test_isAssignableTo_typeVariables() { |
| 1288 // |
| 1289 // class A<E> {} |
| 1290 // class B<F, G> { |
| 1291 // A<F> af; |
| 1292 // f (A<G> ag) { |
| 1293 // af = ag; |
| 1294 // } |
| 1295 // } |
| 1296 // |
| 1112 ClassElement classA = ElementFactory.classElement2("A", ["E"]); | 1297 ClassElement classA = ElementFactory.classElement2("A", ["E"]); |
| 1113 ClassElement classB = ElementFactory.classElement2("B", ["F", "G"]); | 1298 ClassElement classB = ElementFactory.classElement2("B", ["F", "G"]); |
| 1114 InterfaceTypeImpl typeAF = new InterfaceTypeImpl.con1(classA); | 1299 InterfaceTypeImpl typeAF = new InterfaceTypeImpl.con1(classA); |
| 1115 typeAF.typeArguments = <Type2> [classB.typeParameters[0].type]; | 1300 typeAF.typeArguments = <Type2> [classB.typeParameters[0].type]; |
| 1116 InterfaceTypeImpl typeAG = new InterfaceTypeImpl.con1(classA); | 1301 InterfaceTypeImpl typeAG = new InterfaceTypeImpl.con1(classA); |
| 1117 typeAG.typeArguments = <Type2> [classB.typeParameters[1].type]; | 1302 typeAG.typeArguments = <Type2> [classB.typeParameters[1].type]; |
| 1118 JUnitTestCase.assertFalse(typeAG.isAssignableTo(typeAF)); | 1303 JUnitTestCase.assertFalse(typeAG.isAssignableTo(typeAF)); |
| 1119 } | 1304 } |
| 1120 | 1305 |
| 1121 void test_isAssignableTo_void() { | 1306 void test_isAssignableTo_void() { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1173 JUnitTestCase.assertTrue(typeAJ.isMoreSpecificThan(typeAI)); | 1358 JUnitTestCase.assertTrue(typeAJ.isMoreSpecificThan(typeAI)); |
| 1174 JUnitTestCase.assertFalse(typeAI.isMoreSpecificThan(typeAJ)); | 1359 JUnitTestCase.assertFalse(typeAI.isMoreSpecificThan(typeAJ)); |
| 1175 } | 1360 } |
| 1176 | 1361 |
| 1177 void test_isMoreSpecificThan_directSupertype() { | 1362 void test_isMoreSpecificThan_directSupertype() { |
| 1178 ClassElement classA = ElementFactory.classElement2("A", []); | 1363 ClassElement classA = ElementFactory.classElement2("A", []); |
| 1179 ClassElement classB = ElementFactory.classElement("B", classA.type, []); | 1364 ClassElement classB = ElementFactory.classElement("B", classA.type, []); |
| 1180 InterfaceType typeA = classA.type; | 1365 InterfaceType typeA = classA.type; |
| 1181 InterfaceType typeB = classB.type; | 1366 InterfaceType typeB = classB.type; |
| 1182 JUnitTestCase.assertTrue(typeB.isMoreSpecificThan(typeA)); | 1367 JUnitTestCase.assertTrue(typeB.isMoreSpecificThan(typeA)); |
| 1368 // the opposite test tests a different branch in isMoreSpecificThan() |
| 1183 JUnitTestCase.assertFalse(typeA.isMoreSpecificThan(typeB)); | 1369 JUnitTestCase.assertFalse(typeA.isMoreSpecificThan(typeB)); |
| 1184 } | 1370 } |
| 1185 | 1371 |
| 1186 void test_isMoreSpecificThan_dynamic() { | 1372 void test_isMoreSpecificThan_dynamic() { |
| 1187 InterfaceType type = ElementFactory.classElement2("A", []).type; | 1373 InterfaceType type = ElementFactory.classElement2("A", []).type; |
| 1188 JUnitTestCase.assertTrue(type.isMoreSpecificThan(DynamicTypeImpl.instance)); | 1374 JUnitTestCase.assertTrue(type.isMoreSpecificThan(DynamicTypeImpl.instance)); |
| 1189 } | 1375 } |
| 1190 | 1376 |
| 1191 void test_isMoreSpecificThan_self() { | 1377 void test_isMoreSpecificThan_self() { |
| 1192 InterfaceType type = ElementFactory.classElement2("A", []).type; | 1378 InterfaceType type = ElementFactory.classElement2("A", []).type; |
| 1193 JUnitTestCase.assertTrue(type.isMoreSpecificThan(type)); | 1379 JUnitTestCase.assertTrue(type.isMoreSpecificThan(type)); |
| 1194 } | 1380 } |
| 1195 | 1381 |
| 1196 void test_isMoreSpecificThan_transitive_interface() { | 1382 void test_isMoreSpecificThan_transitive_interface() { |
| 1383 // |
| 1384 // class A {} |
| 1385 // class B extends A {} |
| 1386 // class C implements B {} |
| 1387 // |
| 1197 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1388 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1198 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 1389 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 1199 ClassElementImpl classC = ElementFactory.classElement2("C", []); | 1390 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
| 1200 classC.interfaces = <InterfaceType> [classB.type]; | 1391 classC.interfaces = <InterfaceType> [classB.type]; |
| 1201 InterfaceType typeA = classA.type; | 1392 InterfaceType typeA = classA.type; |
| 1202 InterfaceType typeC = classC.type; | 1393 InterfaceType typeC = classC.type; |
| 1203 JUnitTestCase.assertTrue(typeC.isMoreSpecificThan(typeA)); | 1394 JUnitTestCase.assertTrue(typeC.isMoreSpecificThan(typeA)); |
| 1204 } | 1395 } |
| 1205 | 1396 |
| 1206 void test_isMoreSpecificThan_transitive_mixin() { | 1397 void test_isMoreSpecificThan_transitive_mixin() { |
| 1398 // |
| 1399 // class A {} |
| 1400 // class B extends A {} |
| 1401 // class C with B {} |
| 1402 // |
| 1207 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1403 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1208 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 1404 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 1209 ClassElementImpl classC = ElementFactory.classElement2("C", []); | 1405 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
| 1210 classC.mixins = <InterfaceType> [classB.type]; | 1406 classC.mixins = <InterfaceType> [classB.type]; |
| 1211 InterfaceType typeA = classA.type; | 1407 InterfaceType typeA = classA.type; |
| 1212 InterfaceType typeC = classC.type; | 1408 InterfaceType typeC = classC.type; |
| 1213 JUnitTestCase.assertTrue(typeC.isMoreSpecificThan(typeA)); | 1409 JUnitTestCase.assertTrue(typeC.isMoreSpecificThan(typeA)); |
| 1214 } | 1410 } |
| 1215 | 1411 |
| 1216 void test_isMoreSpecificThan_transitive_recursive() { | 1412 void test_isMoreSpecificThan_transitive_recursive() { |
| 1413 // |
| 1414 // class A extends B {} |
| 1415 // class B extends A {} |
| 1416 // class C {} |
| 1417 // |
| 1217 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1418 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1218 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 1419 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 1219 ClassElementImpl classC = ElementFactory.classElement2("C", []); | 1420 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
| 1220 InterfaceType typeA = classA.type; | 1421 InterfaceType typeA = classA.type; |
| 1221 InterfaceType typeC = classC.type; | 1422 InterfaceType typeC = classC.type; |
| 1222 classA.supertype = classB.type; | 1423 classA.supertype = classB.type; |
| 1223 JUnitTestCase.assertFalse(typeA.isMoreSpecificThan(typeC)); | 1424 JUnitTestCase.assertFalse(typeA.isMoreSpecificThan(typeC)); |
| 1224 } | 1425 } |
| 1225 | 1426 |
| 1226 void test_isMoreSpecificThan_transitive_superclass() { | 1427 void test_isMoreSpecificThan_transitive_superclass() { |
| 1428 // |
| 1429 // class A {} |
| 1430 // class B extends A {} |
| 1431 // class C extends B {} |
| 1432 // |
| 1227 ClassElement classA = ElementFactory.classElement2("A", []); | 1433 ClassElement classA = ElementFactory.classElement2("A", []); |
| 1228 ClassElement classB = ElementFactory.classElement("B", classA.type, []); | 1434 ClassElement classB = ElementFactory.classElement("B", classA.type, []); |
| 1229 ClassElement classC = ElementFactory.classElement("C", classB.type, []); | 1435 ClassElement classC = ElementFactory.classElement("C", classB.type, []); |
| 1230 InterfaceType typeA = classA.type; | 1436 InterfaceType typeA = classA.type; |
| 1231 InterfaceType typeC = classC.type; | 1437 InterfaceType typeC = classC.type; |
| 1232 JUnitTestCase.assertTrue(typeC.isMoreSpecificThan(typeA)); | 1438 JUnitTestCase.assertTrue(typeC.isMoreSpecificThan(typeA)); |
| 1233 } | 1439 } |
| 1234 | 1440 |
| 1235 void test_isSubtypeOf_directSubtype() { | 1441 void test_isSubtypeOf_directSubtype() { |
| 1236 ClassElement classA = ElementFactory.classElement2("A", []); | 1442 ClassElement classA = ElementFactory.classElement2("A", []); |
| 1237 ClassElement classB = ElementFactory.classElement("B", classA.type, []); | 1443 ClassElement classB = ElementFactory.classElement("B", classA.type, []); |
| 1238 InterfaceType typeA = classA.type; | 1444 InterfaceType typeA = classA.type; |
| 1239 InterfaceType typeB = classB.type; | 1445 InterfaceType typeB = classB.type; |
| 1240 JUnitTestCase.assertTrue(typeB.isSubtypeOf(typeA)); | 1446 JUnitTestCase.assertTrue(typeB.isSubtypeOf(typeA)); |
| 1241 JUnitTestCase.assertFalse(typeA.isSubtypeOf(typeB)); | 1447 JUnitTestCase.assertFalse(typeA.isSubtypeOf(typeB)); |
| 1242 } | 1448 } |
| 1243 | 1449 |
| 1244 void test_isSubtypeOf_dynamic() { | 1450 void test_isSubtypeOf_dynamic() { |
| 1245 ClassElement classA = ElementFactory.classElement2("A", []); | 1451 ClassElement classA = ElementFactory.classElement2("A", []); |
| 1246 InterfaceType typeA = classA.type; | 1452 InterfaceType typeA = classA.type; |
| 1247 Type2 dynamicType = DynamicTypeImpl.instance; | 1453 Type2 dynamicType = DynamicTypeImpl.instance; |
| 1248 JUnitTestCase.assertTrue(dynamicType.isSubtypeOf(typeA)); | 1454 JUnitTestCase.assertTrue(dynamicType.isSubtypeOf(typeA)); |
| 1249 JUnitTestCase.assertTrue(typeA.isSubtypeOf(dynamicType)); | 1455 JUnitTestCase.assertTrue(typeA.isSubtypeOf(dynamicType)); |
| 1250 } | 1456 } |
| 1251 | 1457 |
| 1252 void test_isSubtypeOf_function() { | 1458 void test_isSubtypeOf_function() { |
| 1459 // |
| 1460 // void f(String s) {} |
| 1461 // class A { |
| 1462 // void call(String s) {} |
| 1463 // } |
| 1464 // |
| 1253 InterfaceType stringType = _typeProvider.stringType; | 1465 InterfaceType stringType = _typeProvider.stringType; |
| 1254 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1466 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1255 classA.methods = <MethodElement> [ElementFactory.methodElement("call", VoidT
ypeImpl.instance, [stringType])]; | 1467 classA.methods = <MethodElement> [ElementFactory.methodElement("call", VoidT
ypeImpl.instance, [stringType])]; |
| 1256 FunctionType functionType = ElementFactory.functionElement5("f", <ClassEleme
nt> [stringType.element]).type; | 1468 FunctionType functionType = ElementFactory.functionElement5("f", <ClassEleme
nt> [stringType.element]).type; |
| 1257 JUnitTestCase.assertTrue(classA.type.isSubtypeOf(functionType)); | 1469 JUnitTestCase.assertTrue(classA.type.isSubtypeOf(functionType)); |
| 1258 } | 1470 } |
| 1259 | 1471 |
| 1260 void test_isSubtypeOf_interface() { | 1472 void test_isSubtypeOf_interface() { |
| 1261 ClassElement classA = ElementFactory.classElement2("A", []); | 1473 ClassElement classA = ElementFactory.classElement2("A", []); |
| 1262 ClassElement classB = ElementFactory.classElement("B", classA.type, []); | 1474 ClassElement classB = ElementFactory.classElement("B", classA.type, []); |
| 1263 ClassElementImpl classC = ElementFactory.classElement2("C", []); | 1475 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
| 1264 InterfaceType typeObject = classA.supertype; | 1476 InterfaceType typeObject = classA.supertype; |
| 1265 InterfaceType typeA = classA.type; | 1477 InterfaceType typeA = classA.type; |
| 1266 InterfaceType typeB = classB.type; | 1478 InterfaceType typeB = classB.type; |
| 1267 InterfaceType typeC = classC.type; | 1479 InterfaceType typeC = classC.type; |
| 1268 classC.interfaces = <InterfaceType> [typeB]; | 1480 classC.interfaces = <InterfaceType> [typeB]; |
| 1269 JUnitTestCase.assertTrue(typeC.isSubtypeOf(typeB)); | 1481 JUnitTestCase.assertTrue(typeC.isSubtypeOf(typeB)); |
| 1270 JUnitTestCase.assertTrue(typeC.isSubtypeOf(typeObject)); | 1482 JUnitTestCase.assertTrue(typeC.isSubtypeOf(typeObject)); |
| 1271 JUnitTestCase.assertTrue(typeC.isSubtypeOf(typeA)); | 1483 JUnitTestCase.assertTrue(typeC.isSubtypeOf(typeA)); |
| 1272 JUnitTestCase.assertFalse(typeA.isSubtypeOf(typeC)); | 1484 JUnitTestCase.assertFalse(typeA.isSubtypeOf(typeC)); |
| 1273 } | 1485 } |
| 1274 | 1486 |
| 1275 void test_isSubtypeOf_mixins() { | 1487 void test_isSubtypeOf_mixins() { |
| 1488 // |
| 1489 // class A {} |
| 1490 // class B extends A {} |
| 1491 // class C with B {} |
| 1492 // |
| 1276 ClassElement classA = ElementFactory.classElement2("A", []); | 1493 ClassElement classA = ElementFactory.classElement2("A", []); |
| 1277 ClassElement classB = ElementFactory.classElement("B", classA.type, []); | 1494 ClassElement classB = ElementFactory.classElement("B", classA.type, []); |
| 1278 ClassElementImpl classC = ElementFactory.classElement2("C", []); | 1495 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
| 1279 InterfaceType typeObject = classA.supertype; | 1496 InterfaceType typeObject = classA.supertype; |
| 1280 InterfaceType typeA = classA.type; | 1497 InterfaceType typeA = classA.type; |
| 1281 InterfaceType typeB = classB.type; | 1498 InterfaceType typeB = classB.type; |
| 1282 InterfaceType typeC = classC.type; | 1499 InterfaceType typeC = classC.type; |
| 1283 classC.mixins = <InterfaceType> [typeB]; | 1500 classC.mixins = <InterfaceType> [typeB]; |
| 1284 JUnitTestCase.assertTrue(typeC.isSubtypeOf(typeB)); | 1501 JUnitTestCase.assertTrue(typeC.isSubtypeOf(typeB)); |
| 1285 JUnitTestCase.assertTrue(typeC.isSubtypeOf(typeObject)); | 1502 JUnitTestCase.assertTrue(typeC.isSubtypeOf(typeObject)); |
| 1286 JUnitTestCase.assertTrue(typeC.isSubtypeOf(typeA)); | 1503 JUnitTestCase.assertTrue(typeC.isSubtypeOf(typeA)); |
| 1287 JUnitTestCase.assertFalse(typeA.isSubtypeOf(typeC)); | 1504 JUnitTestCase.assertFalse(typeA.isSubtypeOf(typeC)); |
| 1288 } | 1505 } |
| 1289 | 1506 |
| 1290 void test_isSubtypeOf_object() { | 1507 void test_isSubtypeOf_object() { |
| 1291 ClassElement classA = ElementFactory.classElement2("A", []); | 1508 ClassElement classA = ElementFactory.classElement2("A", []); |
| 1292 InterfaceType typeA = classA.type; | 1509 InterfaceType typeA = classA.type; |
| 1293 InterfaceType typeObject = classA.supertype; | 1510 InterfaceType typeObject = classA.supertype; |
| 1294 JUnitTestCase.assertTrue(typeA.isSubtypeOf(typeObject)); | 1511 JUnitTestCase.assertTrue(typeA.isSubtypeOf(typeObject)); |
| 1295 JUnitTestCase.assertFalse(typeObject.isSubtypeOf(typeA)); | 1512 JUnitTestCase.assertFalse(typeObject.isSubtypeOf(typeA)); |
| 1296 } | 1513 } |
| 1297 | 1514 |
| 1298 void test_isSubtypeOf_self() { | 1515 void test_isSubtypeOf_self() { |
| 1299 ClassElement classA = ElementFactory.classElement2("A", []); | 1516 ClassElement classA = ElementFactory.classElement2("A", []); |
| 1300 InterfaceType typeA = classA.type; | 1517 InterfaceType typeA = classA.type; |
| 1301 JUnitTestCase.assertTrue(typeA.isSubtypeOf(typeA)); | 1518 JUnitTestCase.assertTrue(typeA.isSubtypeOf(typeA)); |
| 1302 } | 1519 } |
| 1303 | 1520 |
| 1304 void test_isSubtypeOf_transitive_recursive() { | 1521 void test_isSubtypeOf_transitive_recursive() { |
| 1522 // |
| 1523 // class A extends B {} |
| 1524 // class B extends A {} |
| 1525 // class C {} |
| 1526 // |
| 1305 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1527 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1306 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 1528 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 1307 ClassElementImpl classC = ElementFactory.classElement2("C", []); | 1529 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
| 1308 InterfaceType typeA = classA.type; | 1530 InterfaceType typeA = classA.type; |
| 1309 InterfaceType typeC = classC.type; | 1531 InterfaceType typeC = classC.type; |
| 1310 classA.supertype = classB.type; | 1532 classA.supertype = classB.type; |
| 1311 JUnitTestCase.assertFalse(typeA.isSubtypeOf(typeC)); | 1533 JUnitTestCase.assertFalse(typeA.isSubtypeOf(typeC)); |
| 1312 } | 1534 } |
| 1313 | 1535 |
| 1314 void test_isSubtypeOf_transitive_superclass() { | 1536 void test_isSubtypeOf_transitive_superclass() { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1328 ClassElement classJ = ElementFactory.classElement("J", classI.type, []); | 1550 ClassElement classJ = ElementFactory.classElement("J", classI.type, []); |
| 1329 ClassElement classK = ElementFactory.classElement2("K", []); | 1551 ClassElement classK = ElementFactory.classElement2("K", []); |
| 1330 InterfaceType typeA = classA.type; | 1552 InterfaceType typeA = classA.type; |
| 1331 InterfaceType typeA_dynamic = typeA.substitute4(<Type2> [dynamicType]); | 1553 InterfaceType typeA_dynamic = typeA.substitute4(<Type2> [dynamicType]); |
| 1332 InterfaceTypeImpl typeAI = new InterfaceTypeImpl.con1(classA); | 1554 InterfaceTypeImpl typeAI = new InterfaceTypeImpl.con1(classA); |
| 1333 InterfaceTypeImpl typeAJ = new InterfaceTypeImpl.con1(classA); | 1555 InterfaceTypeImpl typeAJ = new InterfaceTypeImpl.con1(classA); |
| 1334 InterfaceTypeImpl typeAK = new InterfaceTypeImpl.con1(classA); | 1556 InterfaceTypeImpl typeAK = new InterfaceTypeImpl.con1(classA); |
| 1335 typeAI.typeArguments = <Type2> [classI.type]; | 1557 typeAI.typeArguments = <Type2> [classI.type]; |
| 1336 typeAJ.typeArguments = <Type2> [classJ.type]; | 1558 typeAJ.typeArguments = <Type2> [classJ.type]; |
| 1337 typeAK.typeArguments = <Type2> [classK.type]; | 1559 typeAK.typeArguments = <Type2> [classK.type]; |
| 1560 // A<J> <: A<I> since J <: I |
| 1338 JUnitTestCase.assertTrue(typeAJ.isSubtypeOf(typeAI)); | 1561 JUnitTestCase.assertTrue(typeAJ.isSubtypeOf(typeAI)); |
| 1339 JUnitTestCase.assertFalse(typeAI.isSubtypeOf(typeAJ)); | 1562 JUnitTestCase.assertFalse(typeAI.isSubtypeOf(typeAJ)); |
| 1563 // A<I> <: A<I> since I <: I |
| 1340 JUnitTestCase.assertTrue(typeAI.isSubtypeOf(typeAI)); | 1564 JUnitTestCase.assertTrue(typeAI.isSubtypeOf(typeAI)); |
| 1565 // A <: A<I> and A <: A<J> |
| 1341 JUnitTestCase.assertTrue(typeA_dynamic.isSubtypeOf(typeAI)); | 1566 JUnitTestCase.assertTrue(typeA_dynamic.isSubtypeOf(typeAI)); |
| 1342 JUnitTestCase.assertTrue(typeA_dynamic.isSubtypeOf(typeAJ)); | 1567 JUnitTestCase.assertTrue(typeA_dynamic.isSubtypeOf(typeAJ)); |
| 1568 // A<I> <: A and A<J> <: A |
| 1343 JUnitTestCase.assertTrue(typeAI.isSubtypeOf(typeA_dynamic)); | 1569 JUnitTestCase.assertTrue(typeAI.isSubtypeOf(typeA_dynamic)); |
| 1344 JUnitTestCase.assertTrue(typeAJ.isSubtypeOf(typeA_dynamic)); | 1570 JUnitTestCase.assertTrue(typeAJ.isSubtypeOf(typeA_dynamic)); |
| 1571 // A<I> !<: A<K> and A<K> !<: A<I> |
| 1345 JUnitTestCase.assertFalse(typeAI.isSubtypeOf(typeAK)); | 1572 JUnitTestCase.assertFalse(typeAI.isSubtypeOf(typeAK)); |
| 1346 JUnitTestCase.assertFalse(typeAK.isSubtypeOf(typeAI)); | 1573 JUnitTestCase.assertFalse(typeAK.isSubtypeOf(typeAI)); |
| 1347 } | 1574 } |
| 1348 | 1575 |
| 1349 void test_isSupertypeOf_directSupertype() { | 1576 void test_isSupertypeOf_directSupertype() { |
| 1350 ClassElement classA = ElementFactory.classElement2("A", []); | 1577 ClassElement classA = ElementFactory.classElement2("A", []); |
| 1351 ClassElement classB = ElementFactory.classElement("B", classA.type, []); | 1578 ClassElement classB = ElementFactory.classElement("B", classA.type, []); |
| 1352 InterfaceType typeA = classA.type; | 1579 InterfaceType typeA = classA.type; |
| 1353 InterfaceType typeB = classB.type; | 1580 InterfaceType typeB = classB.type; |
| 1354 JUnitTestCase.assertFalse(typeB.isSupertypeOf(typeA)); | 1581 JUnitTestCase.assertFalse(typeB.isSupertypeOf(typeA)); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1382 InterfaceType typeB = classB.type; | 1609 InterfaceType typeB = classB.type; |
| 1383 InterfaceType typeC = classC.type; | 1610 InterfaceType typeC = classC.type; |
| 1384 classC.interfaces = <InterfaceType> [typeB]; | 1611 classC.interfaces = <InterfaceType> [typeB]; |
| 1385 JUnitTestCase.assertTrue(typeB.isSupertypeOf(typeC)); | 1612 JUnitTestCase.assertTrue(typeB.isSupertypeOf(typeC)); |
| 1386 JUnitTestCase.assertTrue(typeObject.isSupertypeOf(typeC)); | 1613 JUnitTestCase.assertTrue(typeObject.isSupertypeOf(typeC)); |
| 1387 JUnitTestCase.assertTrue(typeA.isSupertypeOf(typeC)); | 1614 JUnitTestCase.assertTrue(typeA.isSupertypeOf(typeC)); |
| 1388 JUnitTestCase.assertFalse(typeC.isSupertypeOf(typeA)); | 1615 JUnitTestCase.assertFalse(typeC.isSupertypeOf(typeA)); |
| 1389 } | 1616 } |
| 1390 | 1617 |
| 1391 void test_isSupertypeOf_mixins() { | 1618 void test_isSupertypeOf_mixins() { |
| 1619 // |
| 1620 // class A {} |
| 1621 // class B extends A {} |
| 1622 // class C with B {} |
| 1623 // |
| 1392 ClassElement classA = ElementFactory.classElement2("A", []); | 1624 ClassElement classA = ElementFactory.classElement2("A", []); |
| 1393 ClassElement classB = ElementFactory.classElement("B", classA.type, []); | 1625 ClassElement classB = ElementFactory.classElement("B", classA.type, []); |
| 1394 ClassElementImpl classC = ElementFactory.classElement2("C", []); | 1626 ClassElementImpl classC = ElementFactory.classElement2("C", []); |
| 1395 InterfaceType typeObject = classA.supertype; | 1627 InterfaceType typeObject = classA.supertype; |
| 1396 InterfaceType typeA = classA.type; | 1628 InterfaceType typeA = classA.type; |
| 1397 InterfaceType typeB = classB.type; | 1629 InterfaceType typeB = classB.type; |
| 1398 InterfaceType typeC = classC.type; | 1630 InterfaceType typeC = classC.type; |
| 1399 classC.mixins = <InterfaceType> [typeB]; | 1631 classC.mixins = <InterfaceType> [typeB]; |
| 1400 JUnitTestCase.assertTrue(typeB.isSupertypeOf(typeC)); | 1632 JUnitTestCase.assertTrue(typeB.isSupertypeOf(typeC)); |
| 1401 JUnitTestCase.assertTrue(typeObject.isSupertypeOf(typeC)); | 1633 JUnitTestCase.assertTrue(typeObject.isSupertypeOf(typeC)); |
| 1402 JUnitTestCase.assertTrue(typeA.isSupertypeOf(typeC)); | 1634 JUnitTestCase.assertTrue(typeA.isSupertypeOf(typeC)); |
| 1403 JUnitTestCase.assertFalse(typeC.isSupertypeOf(typeA)); | 1635 JUnitTestCase.assertFalse(typeC.isSupertypeOf(typeA)); |
| 1404 } | 1636 } |
| 1405 | 1637 |
| 1406 void test_isSupertypeOf_object() { | 1638 void test_isSupertypeOf_object() { |
| 1407 ClassElement classA = ElementFactory.classElement2("A", []); | 1639 ClassElement classA = ElementFactory.classElement2("A", []); |
| 1408 InterfaceType typeA = classA.type; | 1640 InterfaceType typeA = classA.type; |
| 1409 InterfaceType typeObject = classA.supertype; | 1641 InterfaceType typeObject = classA.supertype; |
| 1410 JUnitTestCase.assertFalse(typeA.isSupertypeOf(typeObject)); | 1642 JUnitTestCase.assertFalse(typeA.isSupertypeOf(typeObject)); |
| 1411 JUnitTestCase.assertTrue(typeObject.isSupertypeOf(typeA)); | 1643 JUnitTestCase.assertTrue(typeObject.isSupertypeOf(typeA)); |
| 1412 } | 1644 } |
| 1413 | 1645 |
| 1414 void test_isSupertypeOf_self() { | 1646 void test_isSupertypeOf_self() { |
| 1415 ClassElement classA = ElementFactory.classElement2("A", []); | 1647 ClassElement classA = ElementFactory.classElement2("A", []); |
| 1416 InterfaceType typeA = classA.type; | 1648 InterfaceType typeA = classA.type; |
| 1417 JUnitTestCase.assertTrue(typeA.isSupertypeOf(typeA)); | 1649 JUnitTestCase.assertTrue(typeA.isSupertypeOf(typeA)); |
| 1418 } | 1650 } |
| 1419 | 1651 |
| 1420 void test_lookUpGetter_implemented() { | 1652 void test_lookUpGetter_implemented() { |
| 1653 // |
| 1654 // class A { g {} } |
| 1655 // |
| 1421 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1656 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1422 String getterName = "g"; | 1657 String getterName = "g"; |
| 1423 PropertyAccessorElement getterG = ElementFactory.getterElement(getterName, f
alse, null); | 1658 PropertyAccessorElement getterG = ElementFactory.getterElement(getterName, f
alse, null); |
| 1424 classA.accessors = <PropertyAccessorElement> [getterG]; | 1659 classA.accessors = <PropertyAccessorElement> [getterG]; |
| 1425 InterfaceType typeA = classA.type; | 1660 InterfaceType typeA = classA.type; |
| 1426 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); | 1661 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 1427 CompilationUnitElement unit = library.definingCompilationUnit; | 1662 CompilationUnitElement unit = library.definingCompilationUnit; |
| 1428 (unit as CompilationUnitElementImpl).types = <ClassElement> [classA]; | 1663 (unit as CompilationUnitElementImpl).types = <ClassElement> [classA]; |
| 1429 JUnitTestCase.assertSame(getterG, typeA.lookUpGetter(getterName, library)); | 1664 JUnitTestCase.assertSame(getterG, typeA.lookUpGetter(getterName, library)); |
| 1430 } | 1665 } |
| 1431 | 1666 |
| 1432 void test_lookUpGetter_inherited() { | 1667 void test_lookUpGetter_inherited() { |
| 1668 // |
| 1669 // class A { g {} } |
| 1670 // class B extends A {} |
| 1671 // |
| 1433 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1672 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1434 String getterName = "g"; | 1673 String getterName = "g"; |
| 1435 PropertyAccessorElement getterG = ElementFactory.getterElement(getterName, f
alse, null); | 1674 PropertyAccessorElement getterG = ElementFactory.getterElement(getterName, f
alse, null); |
| 1436 classA.accessors = <PropertyAccessorElement> [getterG]; | 1675 classA.accessors = <PropertyAccessorElement> [getterG]; |
| 1437 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 1676 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 1438 InterfaceType typeB = classB.type; | 1677 InterfaceType typeB = classB.type; |
| 1439 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); | 1678 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 1440 CompilationUnitElement unit = library.definingCompilationUnit; | 1679 CompilationUnitElement unit = library.definingCompilationUnit; |
| 1441 (unit as CompilationUnitElementImpl).types = <ClassElement> [classA, classB]
; | 1680 (unit as CompilationUnitElementImpl).types = <ClassElement> [classA, classB]
; |
| 1442 JUnitTestCase.assertSame(getterG, typeB.lookUpGetter(getterName, library)); | 1681 JUnitTestCase.assertSame(getterG, typeB.lookUpGetter(getterName, library)); |
| 1443 } | 1682 } |
| 1444 | 1683 |
| 1445 void test_lookUpGetter_recursive() { | 1684 void test_lookUpGetter_recursive() { |
| 1685 // |
| 1686 // class A extends B {} |
| 1687 // class B extends A {} |
| 1688 // |
| 1446 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1689 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1447 InterfaceType typeA = classA.type; | 1690 InterfaceType typeA = classA.type; |
| 1448 ClassElementImpl classB = ElementFactory.classElement("B", typeA, []); | 1691 ClassElementImpl classB = ElementFactory.classElement("B", typeA, []); |
| 1449 classA.supertype = classB.type; | 1692 classA.supertype = classB.type; |
| 1450 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); | 1693 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 1451 CompilationUnitElement unit = library.definingCompilationUnit; | 1694 CompilationUnitElement unit = library.definingCompilationUnit; |
| 1452 (unit as CompilationUnitElementImpl).types = <ClassElement> [classA, classB]
; | 1695 (unit as CompilationUnitElementImpl).types = <ClassElement> [classA, classB]
; |
| 1453 JUnitTestCase.assertNull(typeA.lookUpGetter("g", library)); | 1696 JUnitTestCase.assertNull(typeA.lookUpGetter("g", library)); |
| 1454 } | 1697 } |
| 1455 | 1698 |
| 1456 void test_lookUpGetter_unimplemented() { | 1699 void test_lookUpGetter_unimplemented() { |
| 1700 // |
| 1701 // class A {} |
| 1702 // |
| 1457 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1703 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1458 InterfaceType typeA = classA.type; | 1704 InterfaceType typeA = classA.type; |
| 1459 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); | 1705 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 1460 CompilationUnitElement unit = library.definingCompilationUnit; | 1706 CompilationUnitElement unit = library.definingCompilationUnit; |
| 1461 (unit as CompilationUnitElementImpl).types = <ClassElement> [classA]; | 1707 (unit as CompilationUnitElementImpl).types = <ClassElement> [classA]; |
| 1462 JUnitTestCase.assertNull(typeA.lookUpGetter("g", library)); | 1708 JUnitTestCase.assertNull(typeA.lookUpGetter("g", library)); |
| 1463 } | 1709 } |
| 1464 | 1710 |
| 1465 void test_lookUpMethod_implemented() { | 1711 void test_lookUpMethod_implemented() { |
| 1712 // |
| 1713 // class A { m() {} } |
| 1714 // |
| 1466 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1715 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1467 String methodName = "m"; | 1716 String methodName = "m"; |
| 1468 MethodElementImpl methodM = ElementFactory.methodElement(methodName, null, [
]); | 1717 MethodElementImpl methodM = ElementFactory.methodElement(methodName, null, [
]); |
| 1469 classA.methods = <MethodElement> [methodM]; | 1718 classA.methods = <MethodElement> [methodM]; |
| 1470 InterfaceType typeA = classA.type; | 1719 InterfaceType typeA = classA.type; |
| 1471 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); | 1720 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 1472 CompilationUnitElement unit = library.definingCompilationUnit; | 1721 CompilationUnitElement unit = library.definingCompilationUnit; |
| 1473 (unit as CompilationUnitElementImpl).types = <ClassElement> [classA]; | 1722 (unit as CompilationUnitElementImpl).types = <ClassElement> [classA]; |
| 1474 JUnitTestCase.assertSame(methodM, typeA.lookUpMethod(methodName, library)); | 1723 JUnitTestCase.assertSame(methodM, typeA.lookUpMethod(methodName, library)); |
| 1475 } | 1724 } |
| 1476 | 1725 |
| 1477 void test_lookUpMethod_inherited() { | 1726 void test_lookUpMethod_inherited() { |
| 1727 // |
| 1728 // class A { m() {} } |
| 1729 // class B extends A {} |
| 1730 // |
| 1478 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1731 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1479 String methodName = "m"; | 1732 String methodName = "m"; |
| 1480 MethodElementImpl methodM = ElementFactory.methodElement(methodName, null, [
]); | 1733 MethodElementImpl methodM = ElementFactory.methodElement(methodName, null, [
]); |
| 1481 classA.methods = <MethodElement> [methodM]; | 1734 classA.methods = <MethodElement> [methodM]; |
| 1482 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 1735 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 1483 InterfaceType typeB = classB.type; | 1736 InterfaceType typeB = classB.type; |
| 1484 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); | 1737 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 1485 CompilationUnitElement unit = library.definingCompilationUnit; | 1738 CompilationUnitElement unit = library.definingCompilationUnit; |
| 1486 (unit as CompilationUnitElementImpl).types = <ClassElement> [classA, classB]
; | 1739 (unit as CompilationUnitElementImpl).types = <ClassElement> [classA, classB]
; |
| 1487 JUnitTestCase.assertSame(methodM, typeB.lookUpMethod(methodName, library)); | 1740 JUnitTestCase.assertSame(methodM, typeB.lookUpMethod(methodName, library)); |
| 1488 } | 1741 } |
| 1489 | 1742 |
| 1490 void test_lookUpMethod_parameterized() { | 1743 void test_lookUpMethod_parameterized() { |
| 1744 // |
| 1745 // class A<E> { E m(E p) {} } |
| 1746 // class B<F> extends A<F> {} |
| 1747 // |
| 1491 ClassElementImpl classA = ElementFactory.classElement2("A", ["E"]); | 1748 ClassElementImpl classA = ElementFactory.classElement2("A", ["E"]); |
| 1492 Type2 typeE = classA.type.typeArguments[0]; | 1749 Type2 typeE = classA.type.typeArguments[0]; |
| 1493 String methodName = "m"; | 1750 String methodName = "m"; |
| 1494 MethodElementImpl methodM = ElementFactory.methodElement(methodName, typeE,
[typeE]); | 1751 MethodElementImpl methodM = ElementFactory.methodElement(methodName, typeE,
[typeE]); |
| 1495 classA.methods = <MethodElement> [methodM]; | 1752 classA.methods = <MethodElement> [methodM]; |
| 1496 (methodM.type as FunctionTypeImpl).typeArguments = classA.type.typeArguments
; | 1753 (methodM.type as FunctionTypeImpl).typeArguments = classA.type.typeArguments
; |
| 1497 ClassElementImpl classB = ElementFactory.classElement2("B", ["F"]); | 1754 ClassElementImpl classB = ElementFactory.classElement2("B", ["F"]); |
| 1498 InterfaceType typeB = classB.type; | 1755 InterfaceType typeB = classB.type; |
| 1499 InterfaceTypeImpl typeAF = new InterfaceTypeImpl.con1(classA); | 1756 InterfaceTypeImpl typeAF = new InterfaceTypeImpl.con1(classA); |
| 1500 typeAF.typeArguments = <Type2> [typeB.typeArguments[0]]; | 1757 typeAF.typeArguments = <Type2> [typeB.typeArguments[0]]; |
| 1501 classB.supertype = typeAF; | 1758 classB.supertype = typeAF; |
| 1502 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); | 1759 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 1503 CompilationUnitElement unit = library.definingCompilationUnit; | 1760 CompilationUnitElement unit = library.definingCompilationUnit; |
| 1504 (unit as CompilationUnitElementImpl).types = <ClassElement> [classA]; | 1761 (unit as CompilationUnitElementImpl).types = <ClassElement> [classA]; |
| 1762 // |
| 1763 // B<I> |
| 1764 // |
| 1505 InterfaceType typeI = ElementFactory.classElement2("I", []).type; | 1765 InterfaceType typeI = ElementFactory.classElement2("I", []).type; |
| 1506 InterfaceTypeImpl typeBI = new InterfaceTypeImpl.con1(classB); | 1766 InterfaceTypeImpl typeBI = new InterfaceTypeImpl.con1(classB); |
| 1507 typeBI.typeArguments = <Type2> [typeI]; | 1767 typeBI.typeArguments = <Type2> [typeI]; |
| 1508 MethodElement method = typeBI.lookUpMethod(methodName, library); | 1768 MethodElement method = typeBI.lookUpMethod(methodName, library); |
| 1509 JUnitTestCase.assertNotNull(method); | 1769 JUnitTestCase.assertNotNull(method); |
| 1510 FunctionType methodType = method.type; | 1770 FunctionType methodType = method.type; |
| 1511 JUnitTestCase.assertSame(typeI, methodType.returnType); | 1771 JUnitTestCase.assertSame(typeI, methodType.returnType); |
| 1512 List<Type2> parameterTypes = methodType.normalParameterTypes; | 1772 List<Type2> parameterTypes = methodType.normalParameterTypes; |
| 1513 EngineTestCase.assertLength(1, parameterTypes); | 1773 EngineTestCase.assertLength(1, parameterTypes); |
| 1514 JUnitTestCase.assertSame(typeI, parameterTypes[0]); | 1774 JUnitTestCase.assertSame(typeI, parameterTypes[0]); |
| 1515 } | 1775 } |
| 1516 | 1776 |
| 1517 void test_lookUpMethod_recursive() { | 1777 void test_lookUpMethod_recursive() { |
| 1778 // |
| 1779 // class A extends B {} |
| 1780 // class B extends A {} |
| 1781 // |
| 1518 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1782 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1519 InterfaceType typeA = classA.type; | 1783 InterfaceType typeA = classA.type; |
| 1520 ClassElementImpl classB = ElementFactory.classElement("B", typeA, []); | 1784 ClassElementImpl classB = ElementFactory.classElement("B", typeA, []); |
| 1521 classA.supertype = classB.type; | 1785 classA.supertype = classB.type; |
| 1522 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); | 1786 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 1523 CompilationUnitElement unit = library.definingCompilationUnit; | 1787 CompilationUnitElement unit = library.definingCompilationUnit; |
| 1524 (unit as CompilationUnitElementImpl).types = <ClassElement> [classA, classB]
; | 1788 (unit as CompilationUnitElementImpl).types = <ClassElement> [classA, classB]
; |
| 1525 JUnitTestCase.assertNull(typeA.lookUpMethod("m", library)); | 1789 JUnitTestCase.assertNull(typeA.lookUpMethod("m", library)); |
| 1526 } | 1790 } |
| 1527 | 1791 |
| 1528 void test_lookUpMethod_unimplemented() { | 1792 void test_lookUpMethod_unimplemented() { |
| 1793 // |
| 1794 // class A {} |
| 1795 // |
| 1529 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1796 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1530 InterfaceType typeA = classA.type; | 1797 InterfaceType typeA = classA.type; |
| 1531 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); | 1798 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 1532 CompilationUnitElement unit = library.definingCompilationUnit; | 1799 CompilationUnitElement unit = library.definingCompilationUnit; |
| 1533 (unit as CompilationUnitElementImpl).types = <ClassElement> [classA]; | 1800 (unit as CompilationUnitElementImpl).types = <ClassElement> [classA]; |
| 1534 JUnitTestCase.assertNull(typeA.lookUpMethod("m", library)); | 1801 JUnitTestCase.assertNull(typeA.lookUpMethod("m", library)); |
| 1535 } | 1802 } |
| 1536 | 1803 |
| 1537 void test_lookUpSetter_implemented() { | 1804 void test_lookUpSetter_implemented() { |
| 1805 // |
| 1806 // class A { s(x) {} } |
| 1807 // |
| 1538 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1808 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1539 String setterName = "s"; | 1809 String setterName = "s"; |
| 1540 PropertyAccessorElement setterS = ElementFactory.setterElement(setterName, f
alse, null); | 1810 PropertyAccessorElement setterS = ElementFactory.setterElement(setterName, f
alse, null); |
| 1541 classA.accessors = <PropertyAccessorElement> [setterS]; | 1811 classA.accessors = <PropertyAccessorElement> [setterS]; |
| 1542 InterfaceType typeA = classA.type; | 1812 InterfaceType typeA = classA.type; |
| 1543 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); | 1813 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 1544 CompilationUnitElement unit = library.definingCompilationUnit; | 1814 CompilationUnitElement unit = library.definingCompilationUnit; |
| 1545 (unit as CompilationUnitElementImpl).types = <ClassElement> [classA]; | 1815 (unit as CompilationUnitElementImpl).types = <ClassElement> [classA]; |
| 1546 JUnitTestCase.assertSame(setterS, typeA.lookUpSetter(setterName, library)); | 1816 JUnitTestCase.assertSame(setterS, typeA.lookUpSetter(setterName, library)); |
| 1547 } | 1817 } |
| 1548 | 1818 |
| 1549 void test_lookUpSetter_inherited() { | 1819 void test_lookUpSetter_inherited() { |
| 1820 // |
| 1821 // class A { s(x) {} } |
| 1822 // class B extends A {} |
| 1823 // |
| 1550 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1824 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1551 String setterName = "g"; | 1825 String setterName = "g"; |
| 1552 PropertyAccessorElement setterS = ElementFactory.setterElement(setterName, f
alse, null); | 1826 PropertyAccessorElement setterS = ElementFactory.setterElement(setterName, f
alse, null); |
| 1553 classA.accessors = <PropertyAccessorElement> [setterS]; | 1827 classA.accessors = <PropertyAccessorElement> [setterS]; |
| 1554 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); | 1828 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); |
| 1555 InterfaceType typeB = classB.type; | 1829 InterfaceType typeB = classB.type; |
| 1556 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); | 1830 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 1557 CompilationUnitElement unit = library.definingCompilationUnit; | 1831 CompilationUnitElement unit = library.definingCompilationUnit; |
| 1558 (unit as CompilationUnitElementImpl).types = <ClassElement> [classA, classB]
; | 1832 (unit as CompilationUnitElementImpl).types = <ClassElement> [classA, classB]
; |
| 1559 JUnitTestCase.assertSame(setterS, typeB.lookUpSetter(setterName, library)); | 1833 JUnitTestCase.assertSame(setterS, typeB.lookUpSetter(setterName, library)); |
| 1560 } | 1834 } |
| 1561 | 1835 |
| 1562 void test_lookUpSetter_recursive() { | 1836 void test_lookUpSetter_recursive() { |
| 1837 // |
| 1838 // class A extends B {} |
| 1839 // class B extends A {} |
| 1840 // |
| 1563 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1841 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1564 InterfaceType typeA = classA.type; | 1842 InterfaceType typeA = classA.type; |
| 1565 ClassElementImpl classB = ElementFactory.classElement("B", typeA, []); | 1843 ClassElementImpl classB = ElementFactory.classElement("B", typeA, []); |
| 1566 classA.supertype = classB.type; | 1844 classA.supertype = classB.type; |
| 1567 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); | 1845 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 1568 CompilationUnitElement unit = library.definingCompilationUnit; | 1846 CompilationUnitElement unit = library.definingCompilationUnit; |
| 1569 (unit as CompilationUnitElementImpl).types = <ClassElement> [classA, classB]
; | 1847 (unit as CompilationUnitElementImpl).types = <ClassElement> [classA, classB]
; |
| 1570 JUnitTestCase.assertNull(typeA.lookUpSetter("s", library)); | 1848 JUnitTestCase.assertNull(typeA.lookUpSetter("s", library)); |
| 1571 } | 1849 } |
| 1572 | 1850 |
| 1573 void test_lookUpSetter_unimplemented() { | 1851 void test_lookUpSetter_unimplemented() { |
| 1852 // |
| 1853 // class A {} |
| 1854 // |
| 1574 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 1855 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 1575 InterfaceType typeA = classA.type; | 1856 InterfaceType typeA = classA.type; |
| 1576 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); | 1857 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 1577 CompilationUnitElement unit = library.definingCompilationUnit; | 1858 CompilationUnitElement unit = library.definingCompilationUnit; |
| 1578 (unit as CompilationUnitElementImpl).types = <ClassElement> [classA]; | 1859 (unit as CompilationUnitElementImpl).types = <ClassElement> [classA]; |
| 1579 JUnitTestCase.assertNull(typeA.lookUpSetter("s", library)); | 1860 JUnitTestCase.assertNull(typeA.lookUpSetter("s", library)); |
| 1580 } | 1861 } |
| 1581 | 1862 |
| 1582 void test_setTypeArguments() { | 1863 void test_setTypeArguments() { |
| 1583 InterfaceTypeImpl type = ElementFactory.classElement2("A", []).type as Inter
faceTypeImpl; | 1864 InterfaceTypeImpl type = ElementFactory.classElement2("A", []).type as Inter
faceTypeImpl; |
| (...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2199 return field; | 2480 return field; |
| 2200 } | 2481 } |
| 2201 | 2482 |
| 2202 static FieldFormalParameterElementImpl fieldFormalParameter(Identifier name) =
> new FieldFormalParameterElementImpl(name); | 2483 static FieldFormalParameterElementImpl fieldFormalParameter(Identifier name) =
> new FieldFormalParameterElementImpl(name); |
| 2203 | 2484 |
| 2204 static FunctionElementImpl functionElement(String functionName) => functionEle
ment4(functionName, null, null, null, null); | 2485 static FunctionElementImpl functionElement(String functionName) => functionEle
ment4(functionName, null, null, null, null); |
| 2205 | 2486 |
| 2206 static FunctionElementImpl functionElement2(String functionName, ClassElement
returnElement) => functionElement3(functionName, returnElement, null, null); | 2487 static FunctionElementImpl functionElement2(String functionName, ClassElement
returnElement) => functionElement3(functionName, returnElement, null, null); |
| 2207 | 2488 |
| 2208 static FunctionElementImpl functionElement3(String functionName, ClassElement
returnElement, List<ClassElement> normalParameters, List<ClassElement> optionalP
arameters) { | 2489 static FunctionElementImpl functionElement3(String functionName, ClassElement
returnElement, List<ClassElement> normalParameters, List<ClassElement> optionalP
arameters) { |
| 2490 // We don't create parameter elements because we don't have parameter names |
| 2209 FunctionElementImpl functionElement = new FunctionElementImpl.con1(ASTFactor
y.identifier3(functionName)); | 2491 FunctionElementImpl functionElement = new FunctionElementImpl.con1(ASTFactor
y.identifier3(functionName)); |
| 2210 FunctionTypeImpl functionType = new FunctionTypeImpl.con1(functionElement); | 2492 FunctionTypeImpl functionType = new FunctionTypeImpl.con1(functionElement); |
| 2211 functionElement.type = functionType; | 2493 functionElement.type = functionType; |
| 2494 // return type |
| 2212 if (returnElement == null) { | 2495 if (returnElement == null) { |
| 2213 functionElement.returnType = VoidTypeImpl.instance; | 2496 functionElement.returnType = VoidTypeImpl.instance; |
| 2214 } else { | 2497 } else { |
| 2215 functionElement.returnType = returnElement.type; | 2498 functionElement.returnType = returnElement.type; |
| 2216 } | 2499 } |
| 2500 // parameters |
| 2217 int normalCount = normalParameters == null ? 0 : normalParameters.length; | 2501 int normalCount = normalParameters == null ? 0 : normalParameters.length; |
| 2218 int optionalCount = optionalParameters == null ? 0 : optionalParameters.leng
th; | 2502 int optionalCount = optionalParameters == null ? 0 : optionalParameters.leng
th; |
| 2219 int totalCount = normalCount + optionalCount; | 2503 int totalCount = normalCount + optionalCount; |
| 2220 List<ParameterElement> parameters = new List<ParameterElement>(totalCount); | 2504 List<ParameterElement> parameters = new List<ParameterElement>(totalCount); |
| 2221 for (int i = 0; i < totalCount; i++) { | 2505 for (int i = 0; i < totalCount; i++) { |
| 2222 ParameterElementImpl parameter = new ParameterElementImpl.con1(ASTFactory.
identifier3("a${i}")); | 2506 ParameterElementImpl parameter = new ParameterElementImpl.con1(ASTFactory.
identifier3("a${i}")); |
| 2223 if (i < normalCount) { | 2507 if (i < normalCount) { |
| 2224 parameter.type = normalParameters[i].type; | 2508 parameter.type = normalParameters[i].type; |
| 2225 parameter.parameterKind = ParameterKind.REQUIRED; | 2509 parameter.parameterKind = ParameterKind.REQUIRED; |
| 2226 } else { | 2510 } else { |
| 2227 parameter.type = optionalParameters[i - normalCount].type; | 2511 parameter.type = optionalParameters[i - normalCount].type; |
| 2228 parameter.parameterKind = ParameterKind.POSITIONAL; | 2512 parameter.parameterKind = ParameterKind.POSITIONAL; |
| 2229 } | 2513 } |
| 2230 parameters[i] = parameter; | 2514 parameters[i] = parameter; |
| 2231 } | 2515 } |
| 2232 functionElement.parameters = parameters; | 2516 functionElement.parameters = parameters; |
| 2517 // done |
| 2233 return functionElement; | 2518 return functionElement; |
| 2234 } | 2519 } |
| 2235 | 2520 |
| 2236 static FunctionElementImpl functionElement4(String functionName, ClassElement
returnElement, List<ClassElement> normalParameters, List<String> names, List<Cla
ssElement> namedParameters) { | 2521 static FunctionElementImpl functionElement4(String functionName, ClassElement
returnElement, List<ClassElement> normalParameters, List<String> names, List<Cla
ssElement> namedParameters) { |
| 2237 FunctionElementImpl functionElement = new FunctionElementImpl.con1(ASTFactor
y.identifier3(functionName)); | 2522 FunctionElementImpl functionElement = new FunctionElementImpl.con1(ASTFactor
y.identifier3(functionName)); |
| 2238 FunctionTypeImpl functionType = new FunctionTypeImpl.con1(functionElement); | 2523 FunctionTypeImpl functionType = new FunctionTypeImpl.con1(functionElement); |
| 2239 functionElement.type = functionType; | 2524 functionElement.type = functionType; |
| 2525 // parameters |
| 2240 int normalCount = normalParameters == null ? 0 : normalParameters.length; | 2526 int normalCount = normalParameters == null ? 0 : normalParameters.length; |
| 2241 int nameCount = names == null ? 0 : names.length; | 2527 int nameCount = names == null ? 0 : names.length; |
| 2242 int typeCount = namedParameters == null ? 0 : namedParameters.length; | 2528 int typeCount = namedParameters == null ? 0 : namedParameters.length; |
| 2243 if (names != null && nameCount != typeCount) { | 2529 if (names != null && nameCount != typeCount) { |
| 2244 throw new IllegalStateException("The passed String[] and ClassElement[] ar
rays had different lengths."); | 2530 throw new IllegalStateException("The passed String[] and ClassElement[] ar
rays had different lengths."); |
| 2245 } | 2531 } |
| 2246 int totalCount = normalCount + nameCount; | 2532 int totalCount = normalCount + nameCount; |
| 2247 List<ParameterElement> parameters = new List<ParameterElement>(totalCount); | 2533 List<ParameterElement> parameters = new List<ParameterElement>(totalCount); |
| 2248 for (int i = 0; i < totalCount; i++) { | 2534 for (int i = 0; i < totalCount; i++) { |
| 2249 if (i < normalCount) { | 2535 if (i < normalCount) { |
| 2250 ParameterElementImpl parameter = new ParameterElementImpl.con1(ASTFactor
y.identifier3("a${i}")); | 2536 ParameterElementImpl parameter = new ParameterElementImpl.con1(ASTFactor
y.identifier3("a${i}")); |
| 2251 parameter.type = normalParameters[i].type; | 2537 parameter.type = normalParameters[i].type; |
| 2252 parameter.parameterKind = ParameterKind.REQUIRED; | 2538 parameter.parameterKind = ParameterKind.REQUIRED; |
| 2253 parameters[i] = parameter; | 2539 parameters[i] = parameter; |
| 2254 } else { | 2540 } else { |
| 2255 ParameterElementImpl parameter = new ParameterElementImpl.con1(ASTFactor
y.identifier3(names[i - normalCount])); | 2541 ParameterElementImpl parameter = new ParameterElementImpl.con1(ASTFactor
y.identifier3(names[i - normalCount])); |
| 2256 parameter.type = namedParameters[i - normalCount].type; | 2542 parameter.type = namedParameters[i - normalCount].type; |
| 2257 parameter.parameterKind = ParameterKind.NAMED; | 2543 parameter.parameterKind = ParameterKind.NAMED; |
| 2258 parameters[i] = parameter; | 2544 parameters[i] = parameter; |
| 2259 } | 2545 } |
| 2260 } | 2546 } |
| 2261 functionElement.parameters = parameters; | 2547 functionElement.parameters = parameters; |
| 2548 // return type |
| 2262 if (returnElement == null) { | 2549 if (returnElement == null) { |
| 2263 functionElement.returnType = VoidTypeImpl.instance; | 2550 functionElement.returnType = VoidTypeImpl.instance; |
| 2264 } else { | 2551 } else { |
| 2265 functionElement.returnType = returnElement.type; | 2552 functionElement.returnType = returnElement.type; |
| 2266 } | 2553 } |
| 2267 return functionElement; | 2554 return functionElement; |
| 2268 } | 2555 } |
| 2269 | 2556 |
| 2270 static FunctionElementImpl functionElement5(String functionName, List<ClassEle
ment> normalParameters) => functionElement3(functionName, null, normalParameters
, null); | 2557 static FunctionElementImpl functionElement5(String functionName, List<ClassEle
ment> normalParameters) => functionElement3(functionName, null, normalParameters
, null); |
| 2271 | 2558 |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2501 List<InterfaceType> supers = classB.allSupertypes; | 2788 List<InterfaceType> supers = classB.allSupertypes; |
| 2502 EngineTestCase.assertLength(1, supers); | 2789 EngineTestCase.assertLength(1, supers); |
| 2503 } | 2790 } |
| 2504 | 2791 |
| 2505 void test_getField() { | 2792 void test_getField() { |
| 2506 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 2793 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 2507 String fieldName = "f"; | 2794 String fieldName = "f"; |
| 2508 FieldElementImpl field = ElementFactory.fieldElement(fieldName, false, false
, false, null); | 2795 FieldElementImpl field = ElementFactory.fieldElement(fieldName, false, false
, false, null); |
| 2509 classA.fields = <FieldElement> [field]; | 2796 classA.fields = <FieldElement> [field]; |
| 2510 JUnitTestCase.assertSame(field, classA.getField(fieldName)); | 2797 JUnitTestCase.assertSame(field, classA.getField(fieldName)); |
| 2798 // no such field |
| 2511 JUnitTestCase.assertSame(null, classA.getField("noSuchField")); | 2799 JUnitTestCase.assertSame(null, classA.getField("noSuchField")); |
| 2512 } | 2800 } |
| 2513 | 2801 |
| 2514 void test_getMethod_declared() { | 2802 void test_getMethod_declared() { |
| 2515 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 2803 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 2516 String methodName = "m"; | 2804 String methodName = "m"; |
| 2517 MethodElement method = ElementFactory.methodElement(methodName, null, []); | 2805 MethodElement method = ElementFactory.methodElement(methodName, null, []); |
| 2518 classA.methods = <MethodElement> [method]; | 2806 classA.methods = <MethodElement> [method]; |
| 2519 JUnitTestCase.assertSame(method, classA.getMethod(methodName)); | 2807 JUnitTestCase.assertSame(method, classA.getMethod(methodName)); |
| 2520 } | 2808 } |
| 2521 | 2809 |
| 2522 void test_getMethod_undeclared() { | 2810 void test_getMethod_undeclared() { |
| 2523 ClassElementImpl classA = ElementFactory.classElement2("A", []); | 2811 ClassElementImpl classA = ElementFactory.classElement2("A", []); |
| 2524 String methodName = "m"; | 2812 String methodName = "m"; |
| 2525 MethodElement method = ElementFactory.methodElement(methodName, null, []); | 2813 MethodElement method = ElementFactory.methodElement(methodName, null, []); |
| 2526 classA.methods = <MethodElement> [method]; | 2814 classA.methods = <MethodElement> [method]; |
| 2527 JUnitTestCase.assertNull(classA.getMethod("${methodName}x")); | 2815 JUnitTestCase.assertNull(classA.getMethod("${methodName}x")); |
| 2528 } | 2816 } |
| 2529 | 2817 |
| 2530 void test_getNode() { | 2818 void test_getNode() { |
| 2531 AnalysisContextHelper contextHelper = new AnalysisContextHelper(); | 2819 AnalysisContextHelper contextHelper = new AnalysisContextHelper(); |
| 2532 AnalysisContext context = contextHelper.context; | 2820 AnalysisContext context = contextHelper.context; |
| 2533 Source source = contextHelper.addSource("/test.dart", EngineTestCase.createS
ource(["class A {}", "class B {}"])); | 2821 Source source = contextHelper.addSource("/test.dart", EngineTestCase.createS
ource(["class A {}", "class B {}"])); |
| 2822 // prepare CompilationUnitElement |
| 2534 LibraryElement libraryElement = context.computeLibraryElement(source); | 2823 LibraryElement libraryElement = context.computeLibraryElement(source); |
| 2535 CompilationUnitElement unitElement = libraryElement.definingCompilationUnit; | 2824 CompilationUnitElement unitElement = libraryElement.definingCompilationUnit; |
| 2825 // A |
| 2536 { | 2826 { |
| 2537 ClassElement elementA = unitElement.getType("A"); | 2827 ClassElement elementA = unitElement.getType("A"); |
| 2538 ClassDeclaration nodeA = elementA.node; | 2828 ClassDeclaration nodeA = elementA.node; |
| 2539 JUnitTestCase.assertNotNull(nodeA); | 2829 JUnitTestCase.assertNotNull(nodeA); |
| 2540 JUnitTestCase.assertEquals("A", nodeA.name.name); | 2830 JUnitTestCase.assertEquals("A", nodeA.name.name); |
| 2541 JUnitTestCase.assertSame(elementA, nodeA.element); | 2831 JUnitTestCase.assertSame(elementA, nodeA.element); |
| 2542 } | 2832 } |
| 2833 // B |
| 2543 { | 2834 { |
| 2544 ClassElement elementB = unitElement.getType("B"); | 2835 ClassElement elementB = unitElement.getType("B"); |
| 2545 ClassDeclaration nodeB = elementB.node; | 2836 ClassDeclaration nodeB = elementB.node; |
| 2546 JUnitTestCase.assertNotNull(nodeB); | 2837 JUnitTestCase.assertNotNull(nodeB); |
| 2547 JUnitTestCase.assertEquals("B", nodeB.name.name); | 2838 JUnitTestCase.assertEquals("B", nodeB.name.name); |
| 2548 JUnitTestCase.assertSame(elementB, nodeB.element); | 2839 JUnitTestCase.assertSame(elementB, nodeB.element); |
| 2549 } | 2840 } |
| 2550 } | 2841 } |
| 2551 | 2842 |
| 2552 void test_hasNonFinalField_false_const() { | 2843 void test_hasNonFinalField_false_const() { |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2787 runJUnitTest(__test, __test.test_lookUpSetter_undeclared); | 3078 runJUnitTest(__test, __test.test_lookUpSetter_undeclared); |
| 2788 }); | 3079 }); |
| 2789 _ut.test('test_lookUpSetter_undeclared_recursive', () { | 3080 _ut.test('test_lookUpSetter_undeclared_recursive', () { |
| 2790 final __test = new ClassElementImplTest(); | 3081 final __test = new ClassElementImplTest(); |
| 2791 runJUnitTest(__test, __test.test_lookUpSetter_undeclared_recursive); | 3082 runJUnitTest(__test, __test.test_lookUpSetter_undeclared_recursive); |
| 2792 }); | 3083 }); |
| 2793 }); | 3084 }); |
| 2794 } | 3085 } |
| 2795 } | 3086 } |
| 2796 | 3087 |
| 3088 class AngularPropertyKindTest extends EngineTestCase { |
| 3089 void test_ATTR() { |
| 3090 AngularPropertyKind kind = AngularPropertyKind.ATTR; |
| 3091 JUnitTestCase.assertFalse(kind.callsGetter()); |
| 3092 JUnitTestCase.assertTrue(kind.callsSetter()); |
| 3093 } |
| 3094 |
| 3095 void test_CALLBACK() { |
| 3096 AngularPropertyKind kind = AngularPropertyKind.CALLBACK; |
| 3097 JUnitTestCase.assertFalse(kind.callsGetter()); |
| 3098 JUnitTestCase.assertTrue(kind.callsSetter()); |
| 3099 } |
| 3100 |
| 3101 void test_ONE_WAY() { |
| 3102 AngularPropertyKind kind = AngularPropertyKind.ONE_WAY; |
| 3103 JUnitTestCase.assertFalse(kind.callsGetter()); |
| 3104 JUnitTestCase.assertTrue(kind.callsSetter()); |
| 3105 } |
| 3106 |
| 3107 void test_ONE_WAY_ONE_TIME() { |
| 3108 AngularPropertyKind kind = AngularPropertyKind.ONE_WAY_ONE_TIME; |
| 3109 JUnitTestCase.assertFalse(kind.callsGetter()); |
| 3110 JUnitTestCase.assertTrue(kind.callsSetter()); |
| 3111 } |
| 3112 |
| 3113 void test_TWO_WAY() { |
| 3114 AngularPropertyKind kind = AngularPropertyKind.TWO_WAY; |
| 3115 JUnitTestCase.assertTrue(kind.callsGetter()); |
| 3116 JUnitTestCase.assertTrue(kind.callsSetter()); |
| 3117 } |
| 3118 |
| 3119 static dartSuite() { |
| 3120 _ut.group('AngularPropertyKindTest', () { |
| 3121 _ut.test('test_ATTR', () { |
| 3122 final __test = new AngularPropertyKindTest(); |
| 3123 runJUnitTest(__test, __test.test_ATTR); |
| 3124 }); |
| 3125 _ut.test('test_CALLBACK', () { |
| 3126 final __test = new AngularPropertyKindTest(); |
| 3127 runJUnitTest(__test, __test.test_CALLBACK); |
| 3128 }); |
| 3129 _ut.test('test_ONE_WAY', () { |
| 3130 final __test = new AngularPropertyKindTest(); |
| 3131 runJUnitTest(__test, __test.test_ONE_WAY); |
| 3132 }); |
| 3133 _ut.test('test_ONE_WAY_ONE_TIME', () { |
| 3134 final __test = new AngularPropertyKindTest(); |
| 3135 runJUnitTest(__test, __test.test_ONE_WAY_ONE_TIME); |
| 3136 }); |
| 3137 _ut.test('test_TWO_WAY', () { |
| 3138 final __test = new AngularPropertyKindTest(); |
| 3139 runJUnitTest(__test, __test.test_TWO_WAY); |
| 3140 }); |
| 3141 }); |
| 3142 } |
| 3143 } |
| 3144 |
| 2797 class ElementImplTest extends EngineTestCase { | 3145 class ElementImplTest extends EngineTestCase { |
| 2798 void test_equals() { | 3146 void test_equals() { |
| 2799 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); | 3147 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(),
"lib"); |
| 2800 ClassElementImpl classElement = ElementFactory.classElement2("C", []); | 3148 ClassElementImpl classElement = ElementFactory.classElement2("C", []); |
| 2801 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla
ssElement> [classElement]; | 3149 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla
ssElement> [classElement]; |
| 2802 FieldElement field = ElementFactory.fieldElement("next", false, false, false
, classElement.type); | 3150 FieldElement field = ElementFactory.fieldElement("next", false, false, false
, classElement.type); |
| 2803 classElement.fields = <FieldElement> [field]; | 3151 classElement.fields = <FieldElement> [field]; |
| 2804 JUnitTestCase.assertTrue(field == field); | 3152 JUnitTestCase.assertTrue(field == field); |
| 2805 JUnitTestCase.assertFalse(field == field.getter); | 3153 JUnitTestCase.assertFalse(field == field.getter); |
| 2806 JUnitTestCase.assertFalse(field == field.setter); | 3154 JUnitTestCase.assertFalse(field == field.setter); |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2975 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co
n1(ASTFactory.identifier3("f"))); | 3323 FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.co
n1(ASTFactory.identifier3("f"))); |
| 2976 type.hashCode; | 3324 type.hashCode; |
| 2977 } | 3325 } |
| 2978 | 3326 |
| 2979 void test_hashCode_noElement() { | 3327 void test_hashCode_noElement() { |
| 2980 FunctionTypeImpl type = new FunctionTypeImpl.con1(null); | 3328 FunctionTypeImpl type = new FunctionTypeImpl.con1(null); |
| 2981 type.hashCode; | 3329 type.hashCode; |
| 2982 } | 3330 } |
| 2983 | 3331 |
| 2984 void test_isAssignableTo_normalAndPositionalArgs() { | 3332 void test_isAssignableTo_normalAndPositionalArgs() { |
| 3333 // ([a]) -> void <: (a) -> void |
| 2985 ClassElement a = ElementFactory.classElement2("A", []); | 3334 ClassElement a = ElementFactory.classElement2("A", []); |
| 2986 FunctionType t = ElementFactory.functionElement6("t", null, <ClassElement> [
a]).type; | 3335 FunctionType t = ElementFactory.functionElement6("t", null, <ClassElement> [
a]).type; |
| 2987 FunctionType s = ElementFactory.functionElement5("s", <ClassElement> [a]).ty
pe; | 3336 FunctionType s = ElementFactory.functionElement5("s", <ClassElement> [a]).ty
pe; |
| 2988 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); | 3337 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); |
| 2989 JUnitTestCase.assertFalse(s.isSubtypeOf(t)); | 3338 JUnitTestCase.assertFalse(s.isSubtypeOf(t)); |
| 3339 // assignable iff subtype |
| 2990 JUnitTestCase.assertTrue(t.isAssignableTo(s)); | 3340 JUnitTestCase.assertTrue(t.isAssignableTo(s)); |
| 2991 JUnitTestCase.assertFalse(s.isAssignableTo(t)); | 3341 JUnitTestCase.assertFalse(s.isAssignableTo(t)); |
| 2992 } | 3342 } |
| 2993 | 3343 |
| 2994 void test_isSubtypeOf_baseCase_classFunction() { | 3344 void test_isSubtypeOf_baseCase_classFunction() { |
| 3345 // () -> void <: Function |
| 2995 ClassElementImpl functionElement = ElementFactory.classElement2("Function",
[]); | 3346 ClassElementImpl functionElement = ElementFactory.classElement2("Function",
[]); |
| 2996 InterfaceTypeImpl functionType = new InterfaceTypeImpl_FunctionTypeImplTest_
test_isSubtypeOf_baseCase_classFunction(functionElement); | 3347 InterfaceTypeImpl functionType = new InterfaceTypeImpl_FunctionTypeImplTest_
test_isSubtypeOf_baseCase_classFunction(functionElement); |
| 2997 FunctionType f = ElementFactory.functionElement("f").type; | 3348 FunctionType f = ElementFactory.functionElement("f").type; |
| 2998 JUnitTestCase.assertTrue(f.isSubtypeOf(functionType)); | 3349 JUnitTestCase.assertTrue(f.isSubtypeOf(functionType)); |
| 2999 } | 3350 } |
| 3000 | 3351 |
| 3001 void test_isSubtypeOf_baseCase_notFunctionType() { | 3352 void test_isSubtypeOf_baseCase_notFunctionType() { |
| 3353 // class C |
| 3354 // ! () -> void <: C |
| 3002 FunctionType f = ElementFactory.functionElement("f").type; | 3355 FunctionType f = ElementFactory.functionElement("f").type; |
| 3003 InterfaceType t = ElementFactory.classElement2("C", []).type; | 3356 InterfaceType t = ElementFactory.classElement2("C", []).type; |
| 3004 JUnitTestCase.assertFalse(f.isSubtypeOf(t)); | 3357 JUnitTestCase.assertFalse(f.isSubtypeOf(t)); |
| 3005 } | 3358 } |
| 3006 | 3359 |
| 3007 void test_isSubtypeOf_baseCase_null() { | 3360 void test_isSubtypeOf_baseCase_null() { |
| 3361 // ! () -> void <: null |
| 3008 FunctionType f = ElementFactory.functionElement("f").type; | 3362 FunctionType f = ElementFactory.functionElement("f").type; |
| 3009 JUnitTestCase.assertFalse(f.isSubtypeOf(null)); | 3363 JUnitTestCase.assertFalse(f.isSubtypeOf(null)); |
| 3010 } | 3364 } |
| 3011 | 3365 |
| 3012 void test_isSubtypeOf_baseCase_self() { | 3366 void test_isSubtypeOf_baseCase_self() { |
| 3367 // () -> void <: () -> void |
| 3013 FunctionType f = ElementFactory.functionElement("f").type; | 3368 FunctionType f = ElementFactory.functionElement("f").type; |
| 3014 JUnitTestCase.assertTrue(f.isSubtypeOf(f)); | 3369 JUnitTestCase.assertTrue(f.isSubtypeOf(f)); |
| 3015 } | 3370 } |
| 3016 | 3371 |
| 3017 void test_isSubtypeOf_namedParameters_isAssignable() { | 3372 void test_isSubtypeOf_namedParameters_isAssignable() { |
| 3373 // B extends A |
| 3374 // ({name: A}) -> void <: ({name: B}) -> void |
| 3375 // ({name: B}) -> void <: ({name: A}) -> void |
| 3018 ClassElement a = ElementFactory.classElement2("A", []); | 3376 ClassElement a = ElementFactory.classElement2("A", []); |
| 3019 ClassElement b = ElementFactory.classElement("B", a.type, []); | 3377 ClassElement b = ElementFactory.classElement("B", a.type, []); |
| 3020 FunctionType t = ElementFactory.functionElement4("t", null, null, <String> [
"name"], <ClassElement> [a]).type; | 3378 FunctionType t = ElementFactory.functionElement4("t", null, null, <String> [
"name"], <ClassElement> [a]).type; |
| 3021 FunctionType s = ElementFactory.functionElement4("s", null, null, <String> [
"name"], <ClassElement> [b]).type; | 3379 FunctionType s = ElementFactory.functionElement4("s", null, null, <String> [
"name"], <ClassElement> [b]).type; |
| 3022 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); | 3380 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); |
| 3023 JUnitTestCase.assertTrue(s.isSubtypeOf(t)); | 3381 JUnitTestCase.assertTrue(s.isSubtypeOf(t)); |
| 3024 } | 3382 } |
| 3025 | 3383 |
| 3026 void test_isSubtypeOf_namedParameters_isNotAssignable() { | 3384 void test_isSubtypeOf_namedParameters_isNotAssignable() { |
| 3385 // ! ({name: A}) -> void <: ({name: B}) -> void |
| 3027 FunctionType t = ElementFactory.functionElement4("t", null, null, <String> [
"name"], <ClassElement> [ElementFactory.classElement2("A", [])]).type; | 3386 FunctionType t = ElementFactory.functionElement4("t", null, null, <String> [
"name"], <ClassElement> [ElementFactory.classElement2("A", [])]).type; |
| 3028 FunctionType s = ElementFactory.functionElement4("s", null, null, <String> [
"name"], <ClassElement> [ElementFactory.classElement2("B", [])]).type; | 3387 FunctionType s = ElementFactory.functionElement4("s", null, null, <String> [
"name"], <ClassElement> [ElementFactory.classElement2("B", [])]).type; |
| 3029 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); | 3388 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); |
| 3030 } | 3389 } |
| 3031 | 3390 |
| 3032 void test_isSubtypeOf_namedParameters_namesDifferent() { | 3391 void test_isSubtypeOf_namedParameters_namesDifferent() { |
| 3392 // B extends A |
| 3393 // void t({A name}) {} |
| 3394 // void s({A diff}) {} |
| 3395 // ! t <: s |
| 3396 // ! s <: t |
| 3033 ClassElement a = ElementFactory.classElement2("A", []); | 3397 ClassElement a = ElementFactory.classElement2("A", []); |
| 3034 ClassElement b = ElementFactory.classElement("B", a.type, []); | 3398 ClassElement b = ElementFactory.classElement("B", a.type, []); |
| 3035 FunctionType t = ElementFactory.functionElement4("t", null, null, <String> [
"name"], <ClassElement> [a]).type; | 3399 FunctionType t = ElementFactory.functionElement4("t", null, null, <String> [
"name"], <ClassElement> [a]).type; |
| 3036 FunctionType s = ElementFactory.functionElement4("s", null, null, <String> [
"diff"], <ClassElement> [b]).type; | 3400 FunctionType s = ElementFactory.functionElement4("s", null, null, <String> [
"diff"], <ClassElement> [b]).type; |
| 3037 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); | 3401 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); |
| 3038 JUnitTestCase.assertFalse(s.isSubtypeOf(t)); | 3402 JUnitTestCase.assertFalse(s.isSubtypeOf(t)); |
| 3039 } | 3403 } |
| 3040 | 3404 |
| 3041 void test_isSubtypeOf_namedParameters_orderOfParams() { | 3405 void test_isSubtypeOf_namedParameters_orderOfParams() { |
| 3406 // B extends A |
| 3407 // ({A: A, B: B}) -> void <: ({B: B, A: A}) -> void |
| 3042 ClassElement a = ElementFactory.classElement2("A", []); | 3408 ClassElement a = ElementFactory.classElement2("A", []); |
| 3043 ClassElement b = ElementFactory.classElement("B", a.type, []); | 3409 ClassElement b = ElementFactory.classElement("B", a.type, []); |
| 3044 FunctionType t = ElementFactory.functionElement4("t", null, null, <String> [
"A", "B"], <ClassElement> [a, b]).type; | 3410 FunctionType t = ElementFactory.functionElement4("t", null, null, <String> [
"A", "B"], <ClassElement> [a, b]).type; |
| 3045 FunctionType s = ElementFactory.functionElement4("s", null, null, <String> [
"B", "A"], <ClassElement> [b, a]).type; | 3411 FunctionType s = ElementFactory.functionElement4("s", null, null, <String> [
"B", "A"], <ClassElement> [b, a]).type; |
| 3046 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); | 3412 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); |
| 3047 } | 3413 } |
| 3048 | 3414 |
| 3049 void test_isSubtypeOf_namedParameters_orderOfParams2() { | 3415 void test_isSubtypeOf_namedParameters_orderOfParams2() { |
| 3416 // B extends A |
| 3417 // ! ({B: B}) -> void <: ({B: B, A: A}) -> void |
| 3050 ClassElement a = ElementFactory.classElement2("A", []); | 3418 ClassElement a = ElementFactory.classElement2("A", []); |
| 3051 ClassElement b = ElementFactory.classElement("B", a.type, []); | 3419 ClassElement b = ElementFactory.classElement("B", a.type, []); |
| 3052 FunctionType t = ElementFactory.functionElement4("t", null, null, <String> [
"B"], <ClassElement> [b]).type; | 3420 FunctionType t = ElementFactory.functionElement4("t", null, null, <String> [
"B"], <ClassElement> [b]).type; |
| 3053 FunctionType s = ElementFactory.functionElement4("s", null, null, <String> [
"B", "A"], <ClassElement> [b, a]).type; | 3421 FunctionType s = ElementFactory.functionElement4("s", null, null, <String> [
"B", "A"], <ClassElement> [b, a]).type; |
| 3054 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); | 3422 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); |
| 3055 } | 3423 } |
| 3056 | 3424 |
| 3057 void test_isSubtypeOf_namedParameters_orderOfParams3() { | 3425 void test_isSubtypeOf_namedParameters_orderOfParams3() { |
| 3426 // B extends A |
| 3427 // ({A: A, B: B}) -> void <: ({A: A}) -> void |
| 3058 ClassElement a = ElementFactory.classElement2("A", []); | 3428 ClassElement a = ElementFactory.classElement2("A", []); |
| 3059 ClassElement b = ElementFactory.classElement("B", a.type, []); | 3429 ClassElement b = ElementFactory.classElement("B", a.type, []); |
| 3060 FunctionType t = ElementFactory.functionElement4("t", null, null, <String> [
"A", "B"], <ClassElement> [a, b]).type; | 3430 FunctionType t = ElementFactory.functionElement4("t", null, null, <String> [
"A", "B"], <ClassElement> [a, b]).type; |
| 3061 FunctionType s = ElementFactory.functionElement4("s", null, null, <String> [
"B"], <ClassElement> [b]).type; | 3431 FunctionType s = ElementFactory.functionElement4("s", null, null, <String> [
"B"], <ClassElement> [b]).type; |
| 3062 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); | 3432 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); |
| 3063 } | 3433 } |
| 3064 | 3434 |
| 3065 void test_isSubtypeOf_namedParameters_sHasMoreParams() { | 3435 void test_isSubtypeOf_namedParameters_sHasMoreParams() { |
| 3436 // B extends A |
| 3437 // ! ({name: A}) -> void <: ({name: B, name2: B}) -> void |
| 3066 ClassElement a = ElementFactory.classElement2("A", []); | 3438 ClassElement a = ElementFactory.classElement2("A", []); |
| 3067 ClassElement b = ElementFactory.classElement("B", a.type, []); | 3439 ClassElement b = ElementFactory.classElement("B", a.type, []); |
| 3068 FunctionType t = ElementFactory.functionElement4("t", null, null, <String> [
"name"], <ClassElement> [a]).type; | 3440 FunctionType t = ElementFactory.functionElement4("t", null, null, <String> [
"name"], <ClassElement> [a]).type; |
| 3069 FunctionType s = ElementFactory.functionElement4("s", null, null, <String> [
"name", "name2"], <ClassElement> [b, b]).type; | 3441 FunctionType s = ElementFactory.functionElement4("s", null, null, <String> [
"name", "name2"], <ClassElement> [b, b]).type; |
| 3070 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); | 3442 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); |
| 3071 } | 3443 } |
| 3072 | 3444 |
| 3073 void test_isSubtypeOf_namedParameters_tHasMoreParams() { | 3445 void test_isSubtypeOf_namedParameters_tHasMoreParams() { |
| 3446 // B extends A |
| 3447 // ({name: A, name2: A}) -> void <: ({name: B}) -> void |
| 3074 ClassElement a = ElementFactory.classElement2("A", []); | 3448 ClassElement a = ElementFactory.classElement2("A", []); |
| 3075 ClassElement b = ElementFactory.classElement("B", a.type, []); | 3449 ClassElement b = ElementFactory.classElement("B", a.type, []); |
| 3076 FunctionType t = ElementFactory.functionElement4("t", null, null, <String> [
"name", "name2"], <ClassElement> [a, a]).type; | 3450 FunctionType t = ElementFactory.functionElement4("t", null, null, <String> [
"name", "name2"], <ClassElement> [a, a]).type; |
| 3077 FunctionType s = ElementFactory.functionElement4("s", null, null, <String> [
"name"], <ClassElement> [b]).type; | 3451 FunctionType s = ElementFactory.functionElement4("s", null, null, <String> [
"name"], <ClassElement> [b]).type; |
| 3078 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); | 3452 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); |
| 3079 } | 3453 } |
| 3080 | 3454 |
| 3081 void test_isSubtypeOf_normalAndPositionalArgs_1() { | 3455 void test_isSubtypeOf_normalAndPositionalArgs_1() { |
| 3456 // ([a]) -> void <: (a) -> void |
| 3082 ClassElement a = ElementFactory.classElement2("A", []); | 3457 ClassElement a = ElementFactory.classElement2("A", []); |
| 3083 FunctionType t = ElementFactory.functionElement6("t", null, <ClassElement> [
a]).type; | 3458 FunctionType t = ElementFactory.functionElement6("t", null, <ClassElement> [
a]).type; |
| 3084 FunctionType s = ElementFactory.functionElement5("s", <ClassElement> [a]).ty
pe; | 3459 FunctionType s = ElementFactory.functionElement5("s", <ClassElement> [a]).ty
pe; |
| 3085 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); | 3460 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); |
| 3086 JUnitTestCase.assertFalse(s.isSubtypeOf(t)); | 3461 JUnitTestCase.assertFalse(s.isSubtypeOf(t)); |
| 3087 } | 3462 } |
| 3088 | 3463 |
| 3089 void test_isSubtypeOf_normalAndPositionalArgs_2() { | 3464 void test_isSubtypeOf_normalAndPositionalArgs_2() { |
| 3465 // (a, [a]) -> void <: (a) -> void |
| 3090 ClassElement a = ElementFactory.classElement2("A", []); | 3466 ClassElement a = ElementFactory.classElement2("A", []); |
| 3091 FunctionType t = ElementFactory.functionElement6("t", <ClassElement> [a], <C
lassElement> [a]).type; | 3467 FunctionType t = ElementFactory.functionElement6("t", <ClassElement> [a], <C
lassElement> [a]).type; |
| 3092 FunctionType s = ElementFactory.functionElement5("s", <ClassElement> [a]).ty
pe; | 3468 FunctionType s = ElementFactory.functionElement5("s", <ClassElement> [a]).ty
pe; |
| 3093 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); | 3469 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); |
| 3094 JUnitTestCase.assertFalse(s.isSubtypeOf(t)); | 3470 JUnitTestCase.assertFalse(s.isSubtypeOf(t)); |
| 3095 } | 3471 } |
| 3096 | 3472 |
| 3097 void test_isSubtypeOf_normalAndPositionalArgs_3() { | 3473 void test_isSubtypeOf_normalAndPositionalArgs_3() { |
| 3474 // ([a]) -> void <: () -> void |
| 3098 ClassElement a = ElementFactory.classElement2("A", []); | 3475 ClassElement a = ElementFactory.classElement2("A", []); |
| 3099 FunctionType t = ElementFactory.functionElement6("t", null, <ClassElement> [
a]).type; | 3476 FunctionType t = ElementFactory.functionElement6("t", null, <ClassElement> [
a]).type; |
| 3100 FunctionType s = ElementFactory.functionElement("s").type; | 3477 FunctionType s = ElementFactory.functionElement("s").type; |
| 3101 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); | 3478 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); |
| 3102 JUnitTestCase.assertFalse(s.isSubtypeOf(t)); | 3479 JUnitTestCase.assertFalse(s.isSubtypeOf(t)); |
| 3103 } | 3480 } |
| 3104 | 3481 |
| 3105 void test_isSubtypeOf_normalAndPositionalArgs_4() { | 3482 void test_isSubtypeOf_normalAndPositionalArgs_4() { |
| 3483 // (a, b, [c, d, e]) -> void <: (a, b, c, [d]) -> void |
| 3106 ClassElement a = ElementFactory.classElement2("A", []); | 3484 ClassElement a = ElementFactory.classElement2("A", []); |
| 3107 ClassElement b = ElementFactory.classElement2("B", []); | 3485 ClassElement b = ElementFactory.classElement2("B", []); |
| 3108 ClassElement c = ElementFactory.classElement2("C", []); | 3486 ClassElement c = ElementFactory.classElement2("C", []); |
| 3109 ClassElement d = ElementFactory.classElement2("D", []); | 3487 ClassElement d = ElementFactory.classElement2("D", []); |
| 3110 ClassElement e = ElementFactory.classElement2("E", []); | 3488 ClassElement e = ElementFactory.classElement2("E", []); |
| 3111 FunctionType t = ElementFactory.functionElement6("t", <ClassElement> [a, b],
<ClassElement> [c, d, e]).type; | 3489 FunctionType t = ElementFactory.functionElement6("t", <ClassElement> [a, b],
<ClassElement> [c, d, e]).type; |
| 3112 FunctionType s = ElementFactory.functionElement6("s", <ClassElement> [a, b,
c], <ClassElement> [d]).type; | 3490 FunctionType s = ElementFactory.functionElement6("s", <ClassElement> [a, b,
c], <ClassElement> [d]).type; |
| 3113 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); | 3491 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); |
| 3114 JUnitTestCase.assertFalse(s.isSubtypeOf(t)); | 3492 JUnitTestCase.assertFalse(s.isSubtypeOf(t)); |
| 3115 } | 3493 } |
| 3116 | 3494 |
| 3117 void test_isSubtypeOf_normalParameters_isAssignable() { | 3495 void test_isSubtypeOf_normalParameters_isAssignable() { |
| 3496 // B extends A |
| 3497 // (a) -> void <: (b) -> void |
| 3498 // (b) -> void <: (a) -> void |
| 3118 ClassElement a = ElementFactory.classElement2("A", []); | 3499 ClassElement a = ElementFactory.classElement2("A", []); |
| 3119 ClassElement b = ElementFactory.classElement("B", a.type, []); | 3500 ClassElement b = ElementFactory.classElement("B", a.type, []); |
| 3120 FunctionType t = ElementFactory.functionElement5("t", <ClassElement> [a]).ty
pe; | 3501 FunctionType t = ElementFactory.functionElement5("t", <ClassElement> [a]).ty
pe; |
| 3121 FunctionType s = ElementFactory.functionElement5("s", <ClassElement> [b]).ty
pe; | 3502 FunctionType s = ElementFactory.functionElement5("s", <ClassElement> [b]).ty
pe; |
| 3122 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); | 3503 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); |
| 3123 JUnitTestCase.assertTrue(s.isSubtypeOf(t)); | 3504 JUnitTestCase.assertTrue(s.isSubtypeOf(t)); |
| 3124 } | 3505 } |
| 3125 | 3506 |
| 3126 void test_isSubtypeOf_normalParameters_isNotAssignable() { | 3507 void test_isSubtypeOf_normalParameters_isNotAssignable() { |
| 3508 // ! (a) -> void <: (b) -> void |
| 3127 FunctionType t = ElementFactory.functionElement5("t", <ClassElement> [Elemen
tFactory.classElement2("A", [])]).type; | 3509 FunctionType t = ElementFactory.functionElement5("t", <ClassElement> [Elemen
tFactory.classElement2("A", [])]).type; |
| 3128 FunctionType s = ElementFactory.functionElement5("s", <ClassElement> [Elemen
tFactory.classElement2("B", [])]).type; | 3510 FunctionType s = ElementFactory.functionElement5("s", <ClassElement> [Elemen
tFactory.classElement2("B", [])]).type; |
| 3129 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); | 3511 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); |
| 3130 } | 3512 } |
| 3131 | 3513 |
| 3132 void test_isSubtypeOf_normalParameters_sHasMoreParams() { | 3514 void test_isSubtypeOf_normalParameters_sHasMoreParams() { |
| 3515 // B extends A |
| 3516 // ! (a) -> void <: (b, b) -> void |
| 3133 ClassElement a = ElementFactory.classElement2("A", []); | 3517 ClassElement a = ElementFactory.classElement2("A", []); |
| 3134 ClassElement b = ElementFactory.classElement("B", a.type, []); | 3518 ClassElement b = ElementFactory.classElement("B", a.type, []); |
| 3135 FunctionType t = ElementFactory.functionElement5("t", <ClassElement> [a]).ty
pe; | 3519 FunctionType t = ElementFactory.functionElement5("t", <ClassElement> [a]).ty
pe; |
| 3136 FunctionType s = ElementFactory.functionElement5("s", <ClassElement> [b, b])
.type; | 3520 FunctionType s = ElementFactory.functionElement5("s", <ClassElement> [b, b])
.type; |
| 3137 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); | 3521 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); |
| 3138 } | 3522 } |
| 3139 | 3523 |
| 3140 void test_isSubtypeOf_normalParameters_tHasMoreParams() { | 3524 void test_isSubtypeOf_normalParameters_tHasMoreParams() { |
| 3525 // B extends A |
| 3526 // ! (a, a) -> void <: (a) -> void |
| 3141 ClassElement a = ElementFactory.classElement2("A", []); | 3527 ClassElement a = ElementFactory.classElement2("A", []); |
| 3142 ClassElement b = ElementFactory.classElement("B", a.type, []); | 3528 ClassElement b = ElementFactory.classElement("B", a.type, []); |
| 3143 FunctionType t = ElementFactory.functionElement5("t", <ClassElement> [a, a])
.type; | 3529 FunctionType t = ElementFactory.functionElement5("t", <ClassElement> [a, a])
.type; |
| 3144 FunctionType s = ElementFactory.functionElement5("s", <ClassElement> [b]).ty
pe; | 3530 FunctionType s = ElementFactory.functionElement5("s", <ClassElement> [b]).ty
pe; |
| 3531 // note, this is a different assertion from the other "tHasMoreParams" tests
, this is |
| 3532 // intentional as it is a difference of the "normal parameters" |
| 3145 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); | 3533 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); |
| 3146 } | 3534 } |
| 3147 | 3535 |
| 3148 void test_isSubtypeOf_Object() { | 3536 void test_isSubtypeOf_Object() { |
| 3537 // () -> void <: Object |
| 3149 FunctionType f = ElementFactory.functionElement("f").type; | 3538 FunctionType f = ElementFactory.functionElement("f").type; |
| 3150 InterfaceType t = ElementFactory.object.type; | 3539 InterfaceType t = ElementFactory.object.type; |
| 3151 JUnitTestCase.assertTrue(f.isSubtypeOf(t)); | 3540 JUnitTestCase.assertTrue(f.isSubtypeOf(t)); |
| 3152 } | 3541 } |
| 3153 | 3542 |
| 3154 void test_isSubtypeOf_positionalParameters_isAssignable() { | 3543 void test_isSubtypeOf_positionalParameters_isAssignable() { |
| 3544 // B extends A |
| 3545 // ([a]) -> void <: ([b]) -> void |
| 3546 // ([b]) -> void <: ([a]) -> void |
| 3155 ClassElement a = ElementFactory.classElement2("A", []); | 3547 ClassElement a = ElementFactory.classElement2("A", []); |
| 3156 ClassElement b = ElementFactory.classElement("B", a.type, []); | 3548 ClassElement b = ElementFactory.classElement("B", a.type, []); |
| 3157 FunctionType t = ElementFactory.functionElement6("t", null, <ClassElement> [
a]).type; | 3549 FunctionType t = ElementFactory.functionElement6("t", null, <ClassElement> [
a]).type; |
| 3158 FunctionType s = ElementFactory.functionElement6("s", null, <ClassElement> [
b]).type; | 3550 FunctionType s = ElementFactory.functionElement6("s", null, <ClassElement> [
b]).type; |
| 3159 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); | 3551 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); |
| 3160 JUnitTestCase.assertTrue(s.isSubtypeOf(t)); | 3552 JUnitTestCase.assertTrue(s.isSubtypeOf(t)); |
| 3161 } | 3553 } |
| 3162 | 3554 |
| 3163 void test_isSubtypeOf_positionalParameters_isNotAssignable() { | 3555 void test_isSubtypeOf_positionalParameters_isNotAssignable() { |
| 3556 // ! ([a]) -> void <: ([b]) -> void |
| 3164 FunctionType t = ElementFactory.functionElement6("t", null, <ClassElement> [
ElementFactory.classElement2("A", [])]).type; | 3557 FunctionType t = ElementFactory.functionElement6("t", null, <ClassElement> [
ElementFactory.classElement2("A", [])]).type; |
| 3165 FunctionType s = ElementFactory.functionElement6("s", null, <ClassElement> [
ElementFactory.classElement2("B", [])]).type; | 3558 FunctionType s = ElementFactory.functionElement6("s", null, <ClassElement> [
ElementFactory.classElement2("B", [])]).type; |
| 3166 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); | 3559 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); |
| 3167 } | 3560 } |
| 3168 | 3561 |
| 3169 void test_isSubtypeOf_positionalParameters_sHasMoreParams() { | 3562 void test_isSubtypeOf_positionalParameters_sHasMoreParams() { |
| 3563 // B extends A |
| 3564 // ! ([a]) -> void <: ([b, b]) -> void |
| 3170 ClassElement a = ElementFactory.classElement2("A", []); | 3565 ClassElement a = ElementFactory.classElement2("A", []); |
| 3171 ClassElement b = ElementFactory.classElement("B", a.type, []); | 3566 ClassElement b = ElementFactory.classElement("B", a.type, []); |
| 3172 FunctionType t = ElementFactory.functionElement6("t", null, <ClassElement> [
a]).type; | 3567 FunctionType t = ElementFactory.functionElement6("t", null, <ClassElement> [
a]).type; |
| 3173 FunctionType s = ElementFactory.functionElement6("s", null, <ClassElement> [
b, b]).type; | 3568 FunctionType s = ElementFactory.functionElement6("s", null, <ClassElement> [
b, b]).type; |
| 3174 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); | 3569 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); |
| 3175 } | 3570 } |
| 3176 | 3571 |
| 3177 void test_isSubtypeOf_positionalParameters_tHasMoreParams() { | 3572 void test_isSubtypeOf_positionalParameters_tHasMoreParams() { |
| 3573 // B extends A |
| 3574 // ([a, a]) -> void <: ([b]) -> void |
| 3178 ClassElement a = ElementFactory.classElement2("A", []); | 3575 ClassElement a = ElementFactory.classElement2("A", []); |
| 3179 ClassElement b = ElementFactory.classElement("B", a.type, []); | 3576 ClassElement b = ElementFactory.classElement("B", a.type, []); |
| 3180 FunctionType t = ElementFactory.functionElement6("t", null, <ClassElement> [
a, a]).type; | 3577 FunctionType t = ElementFactory.functionElement6("t", null, <ClassElement> [
a, a]).type; |
| 3181 FunctionType s = ElementFactory.functionElement6("s", null, <ClassElement> [
b]).type; | 3578 FunctionType s = ElementFactory.functionElement6("s", null, <ClassElement> [
b]).type; |
| 3182 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); | 3579 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); |
| 3183 } | 3580 } |
| 3184 | 3581 |
| 3185 void test_isSubtypeOf_returnType_sIsVoid() { | 3582 void test_isSubtypeOf_returnType_sIsVoid() { |
| 3583 // () -> void <: void |
| 3186 FunctionType t = ElementFactory.functionElement("t").type; | 3584 FunctionType t = ElementFactory.functionElement("t").type; |
| 3187 FunctionType s = ElementFactory.functionElement("s").type; | 3585 FunctionType s = ElementFactory.functionElement("s").type; |
| 3586 // function s has the implicit return type of void, we assert it here |
| 3188 JUnitTestCase.assertTrue(VoidTypeImpl.instance == s.returnType); | 3587 JUnitTestCase.assertTrue(VoidTypeImpl.instance == s.returnType); |
| 3189 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); | 3588 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); |
| 3190 } | 3589 } |
| 3191 | 3590 |
| 3192 void test_isSubtypeOf_returnType_tAssignableToS() { | 3591 void test_isSubtypeOf_returnType_tAssignableToS() { |
| 3592 // B extends A |
| 3593 // () -> A <: () -> B |
| 3594 // () -> B <: () -> A |
| 3193 ClassElement a = ElementFactory.classElement2("A", []); | 3595 ClassElement a = ElementFactory.classElement2("A", []); |
| 3194 ClassElement b = ElementFactory.classElement("B", a.type, []); | 3596 ClassElement b = ElementFactory.classElement("B", a.type, []); |
| 3195 FunctionType t = ElementFactory.functionElement2("t", a).type; | 3597 FunctionType t = ElementFactory.functionElement2("t", a).type; |
| 3196 FunctionType s = ElementFactory.functionElement2("s", b).type; | 3598 FunctionType s = ElementFactory.functionElement2("s", b).type; |
| 3197 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); | 3599 JUnitTestCase.assertTrue(t.isSubtypeOf(s)); |
| 3198 JUnitTestCase.assertTrue(s.isSubtypeOf(t)); | 3600 JUnitTestCase.assertTrue(s.isSubtypeOf(t)); |
| 3199 } | 3601 } |
| 3200 | 3602 |
| 3201 void test_isSubtypeOf_returnType_tNotAssignableToS() { | 3603 void test_isSubtypeOf_returnType_tNotAssignableToS() { |
| 3604 // ! () -> A <: () -> B |
| 3202 FunctionType t = ElementFactory.functionElement2("t", ElementFactory.classEl
ement2("A", [])).type; | 3605 FunctionType t = ElementFactory.functionElement2("t", ElementFactory.classEl
ement2("A", [])).type; |
| 3203 FunctionType s = ElementFactory.functionElement2("s", ElementFactory.classEl
ement2("B", [])).type; | 3606 FunctionType s = ElementFactory.functionElement2("s", ElementFactory.classEl
ement2("B", [])).type; |
| 3204 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); | 3607 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); |
| 3205 } | 3608 } |
| 3206 | 3609 |
| 3207 void test_isSubtypeOf_typeParameters_matchesBounds() { | 3610 void test_isSubtypeOf_typeParameters_matchesBounds() { |
| 3208 TestTypeProvider provider = new TestTypeProvider(); | 3611 TestTypeProvider provider = new TestTypeProvider(); |
| 3209 InterfaceType boolType = provider.boolType; | 3612 InterfaceType boolType = provider.boolType; |
| 3210 InterfaceType stringType = provider.stringType; | 3613 InterfaceType stringType = provider.stringType; |
| 3211 TypeParameterElementImpl parameterB = new TypeParameterElementImpl(ASTFactor
y.identifier3("B")); | 3614 TypeParameterElementImpl parameterB = new TypeParameterElementImpl(ASTFactor
y.identifier3("B")); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 3225 functionElement.parameters = <ParameterElement> [ | 3628 functionElement.parameters = <ParameterElement> [ |
| 3226 ElementFactory.requiredParameter2("c", boolType), | 3629 ElementFactory.requiredParameter2("c", boolType), |
| 3227 ElementFactory.positionalParameter2("d", stringType)]; | 3630 ElementFactory.positionalParameter2("d", stringType)]; |
| 3228 functionElement.returnType = provider.dynamicType; | 3631 functionElement.returnType = provider.dynamicType; |
| 3229 FunctionTypeImpl functionType = new FunctionTypeImpl.con1(functionElement); | 3632 FunctionTypeImpl functionType = new FunctionTypeImpl.con1(functionElement); |
| 3230 functionElement.type = functionType; | 3633 functionElement.type = functionType; |
| 3231 JUnitTestCase.assertTrue(functionType.isAssignableTo(functionAliasType)); | 3634 JUnitTestCase.assertTrue(functionType.isAssignableTo(functionAliasType)); |
| 3232 } | 3635 } |
| 3233 | 3636 |
| 3234 void test_isSubtypeOf_wrongFunctionType_normal_named() { | 3637 void test_isSubtypeOf_wrongFunctionType_normal_named() { |
| 3638 // ! (a) -> void <: ({name: A}) -> void |
| 3639 // ! ({name: A}) -> void <: (a) -> void |
| 3235 ClassElement a = ElementFactory.classElement2("A", []); | 3640 ClassElement a = ElementFactory.classElement2("A", []); |
| 3236 FunctionType t = ElementFactory.functionElement5("t", <ClassElement> [a]).ty
pe; | 3641 FunctionType t = ElementFactory.functionElement5("t", <ClassElement> [a]).ty
pe; |
| 3237 FunctionType s = ElementFactory.functionElement7("s", null, <String> ["name"
], <ClassElement> [a]).type; | 3642 FunctionType s = ElementFactory.functionElement7("s", null, <String> ["name"
], <ClassElement> [a]).type; |
| 3238 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); | 3643 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); |
| 3239 JUnitTestCase.assertFalse(s.isSubtypeOf(t)); | 3644 JUnitTestCase.assertFalse(s.isSubtypeOf(t)); |
| 3240 } | 3645 } |
| 3241 | 3646 |
| 3242 void test_isSubtypeOf_wrongFunctionType_optional_named() { | 3647 void test_isSubtypeOf_wrongFunctionType_optional_named() { |
| 3648 // ! ([a]) -> void <: ({name: A}) -> void |
| 3649 // ! ({name: A}) -> void <: ([a]) -> void |
| 3243 ClassElement a = ElementFactory.classElement2("A", []); | 3650 ClassElement a = ElementFactory.classElement2("A", []); |
| 3244 FunctionType t = ElementFactory.functionElement6("t", null, <ClassElement> [
a]).type; | 3651 FunctionType t = ElementFactory.functionElement6("t", null, <ClassElement> [
a]).type; |
| 3245 FunctionType s = ElementFactory.functionElement7("s", null, <String> ["name"
], <ClassElement> [a]).type; | 3652 FunctionType s = ElementFactory.functionElement7("s", null, <String> ["name"
], <ClassElement> [a]).type; |
| 3246 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); | 3653 JUnitTestCase.assertFalse(t.isSubtypeOf(s)); |
| 3247 JUnitTestCase.assertFalse(s.isSubtypeOf(t)); | 3654 JUnitTestCase.assertFalse(s.isSubtypeOf(t)); |
| 3248 } | 3655 } |
| 3249 | 3656 |
| 3250 void test_setTypeArguments() { | 3657 void test_setTypeArguments() { |
| 3251 ClassElementImpl enclosingClass = ElementFactory.classElement2("C", ["E"]); | 3658 ClassElementImpl enclosingClass = ElementFactory.classElement2("C", ["E"]); |
| 3252 MethodElementImpl methodElement = new MethodElementImpl.con1(ASTFactory.iden
tifier3("m")); | 3659 MethodElementImpl methodElement = new MethodElementImpl.con1(ASTFactory.iden
tifier3("m")); |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3493 } | 3900 } |
| 3494 | 3901 |
| 3495 class InterfaceTypeImpl_FunctionTypeImplTest_test_isSubtypeOf_baseCase_classFunc
tion extends InterfaceTypeImpl { | 3902 class InterfaceTypeImpl_FunctionTypeImplTest_test_isSubtypeOf_baseCase_classFunc
tion extends InterfaceTypeImpl { |
| 3496 InterfaceTypeImpl_FunctionTypeImplTest_test_isSubtypeOf_baseCase_classFunction
(ClassElement arg0) : super.con1(arg0); | 3903 InterfaceTypeImpl_FunctionTypeImplTest_test_isSubtypeOf_baseCase_classFunction
(ClassElement arg0) : super.con1(arg0); |
| 3497 | 3904 |
| 3498 bool get isDartCoreFunction => true; | 3905 bool get isDartCoreFunction => true; |
| 3499 } | 3906 } |
| 3500 | 3907 |
| 3501 main() { | 3908 main() { |
| 3502 ElementKindTest.dartSuite(); | 3909 ElementKindTest.dartSuite(); |
| 3910 AngularPropertyKindTest.dartSuite(); |
| 3503 FunctionTypeImplTest.dartSuite(); | 3911 FunctionTypeImplTest.dartSuite(); |
| 3504 InterfaceTypeImplTest.dartSuite(); | 3912 InterfaceTypeImplTest.dartSuite(); |
| 3505 TypeParameterTypeImplTest.dartSuite(); | 3913 TypeParameterTypeImplTest.dartSuite(); |
| 3506 VoidTypeImplTest.dartSuite(); | 3914 VoidTypeImplTest.dartSuite(); |
| 3507 ClassElementImplTest.dartSuite(); | 3915 ClassElementImplTest.dartSuite(); |
| 3508 ElementLocationImplTest.dartSuite(); | 3916 ElementLocationImplTest.dartSuite(); |
| 3509 ElementImplTest.dartSuite(); | 3917 ElementImplTest.dartSuite(); |
| 3510 LibraryElementImplTest.dartSuite(); | 3918 LibraryElementImplTest.dartSuite(); |
| 3511 MultiplyDefinedElementImplTest.dartSuite(); | 3919 MultiplyDefinedElementImplTest.dartSuite(); |
| 3512 } | 3920 } |
| OLD | NEW |