| 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 library engine.incremental_resolver_test; | 5 library engine.incremental_resolver_test; |
| 6 | 6 |
| 7 import 'package:analyzer/src/generated/ast.dart'; | 7 import 'package:analyzer/src/generated/ast.dart'; |
| 8 import 'package:analyzer/src/generated/element.dart'; | 8 import 'package:analyzer/src/generated/element.dart'; |
| 9 import 'package:analyzer/src/generated/engine.dart'; | 9 import 'package:analyzer/src/generated/engine.dart'; |
| 10 import 'package:analyzer/src/generated/error.dart'; | 10 import 'package:analyzer/src/generated/error.dart'; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 _assertCompilationUnitMatches(false, r''' | 67 _assertCompilationUnitMatches(false, r''' |
| 68 class A {} | 68 class A {} |
| 69 class B {} | 69 class B {} |
| 70 class C {} | 70 class C {} |
| 71 ''', r''' | 71 ''', r''' |
| 72 class A {} | 72 class A {} |
| 73 class B {} | 73 class B {} |
| 74 '''); | 74 '''); |
| 75 } | 75 } |
| 76 | 76 |
| 77 void test_false_class_typeParameters_bounds_add() { |
| 78 _assertCompilationUnitMatches(false, r''' |
| 79 class A {} |
| 80 class B<T> { |
| 81 T f; |
| 82 } |
| 83 ''', r''' |
| 84 class A {} |
| 85 class B<T extends A> { |
| 86 T f; |
| 87 } |
| 88 '''); |
| 89 } |
| 90 |
| 91 void test_false_class_typeParameters_bounds_remove() { |
| 92 _assertCompilationUnitMatches(false, r''' |
| 93 class A {} |
| 94 class B<T extends A> { |
| 95 T f; |
| 96 } |
| 97 ''', r''' |
| 98 class A {} |
| 99 class B<T> { |
| 100 T f; |
| 101 } |
| 102 '''); |
| 103 } |
| 104 |
| 105 void test_false_classTypeAlias_list_add() { |
| 106 _assertCompilationUnitMatches(false, r''' |
| 107 class M {} |
| 108 class A = Object with M; |
| 109 ''', r''' |
| 110 class M {} |
| 111 class A = Object with M; |
| 112 class B = Object with M; |
| 113 '''); |
| 114 } |
| 115 |
| 116 void test_false_classTypeAlias_list_remove() { |
| 117 _assertCompilationUnitMatches(false, r''' |
| 118 class M {} |
| 119 class A = Object with M; |
| 120 class B = Object with M; |
| 121 ''', r''' |
| 122 class M {} |
| 123 class A = Object with M; |
| 124 '''); |
| 125 } |
| 126 |
| 127 void test_false_classTypeAlias_typeParameters_bounds_add() { |
| 128 _assertCompilationUnitMatches(false, r''' |
| 129 class M<T> {} |
| 130 class A {} |
| 131 class B<T> = Object with M<T>; |
| 132 ''', r''' |
| 133 class M<T> {} |
| 134 class A {} |
| 135 class B<T extends A> = Object with M<T>; |
| 136 '''); |
| 137 } |
| 138 |
| 139 void test_false_classTypeAlias_typeParameters_bounds_remove() { |
| 140 _assertCompilationUnitMatches(false, r''' |
| 141 class M<T> {} |
| 142 class A {} |
| 143 class B<T extends A> = Object with M<T>; |
| 144 ''', r''' |
| 145 class M<T> {} |
| 146 class A {} |
| 147 class B<T> = Object with M<T>; |
| 148 '''); |
| 149 } |
| 150 |
| 77 void test_false_constructor_parameters_list_add() { | 151 void test_false_constructor_parameters_list_add() { |
| 78 _assertCompilationUnitMatches(false, r''' | 152 _assertCompilationUnitMatches(false, r''' |
| 79 class A { | 153 class A { |
| 80 A(); | 154 A(); |
| 81 } | 155 } |
| 82 ''', r''' | 156 ''', r''' |
| 83 class A { | 157 class A { |
| 84 A(int p); | 158 A(int p); |
| 85 } | 159 } |
| 86 '''); | 160 '''); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 _assertCompilationUnitMatches(false, r''' | 199 _assertCompilationUnitMatches(false, r''' |
| 126 class A { | 200 class A { |
| 127 A(int p) {} | 201 A(int p) {} |
| 128 } | 202 } |
| 129 ''', r''' | 203 ''', r''' |
| 130 class A { | 204 class A { |
| 131 } | 205 } |
| 132 '''); | 206 '''); |
| 133 } | 207 } |
| 134 | 208 |
| 209 void test_false_enum_constants_add() { |
| 210 resetWithEnum(); |
| 211 _assertCompilationUnitMatches(false, r''' |
| 212 enum E {A, B} |
| 213 ''', r''' |
| 214 enum E {A, B, C} |
| 215 '''); |
| 216 } |
| 217 |
| 218 void test_false_enum_constants_remove() { |
| 219 resetWithEnum(); |
| 220 _assertCompilationUnitMatches(false, r''' |
| 221 enum E {A, B, C} |
| 222 ''', r''' |
| 223 enum E {A, B} |
| 224 '''); |
| 225 } |
| 226 |
| 135 void test_false_extendsClause_add() { | 227 void test_false_extendsClause_add() { |
| 136 _assertCompilationUnitMatches(false, r''' | 228 _assertCompilationUnitMatches(false, r''' |
| 137 class A {} | 229 class A {} |
| 138 class B {} | 230 class B {} |
| 139 ''', r''' | 231 ''', r''' |
| 140 class A {} | 232 class A {} |
| 141 class B extends A {} | 233 class B extends A {} |
| 142 '''); | 234 '''); |
| 143 } | 235 } |
| 144 | 236 |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 } | 549 } |
| 458 | 550 |
| 459 void test_true_class_typeParameters_same() { | 551 void test_true_class_typeParameters_same() { |
| 460 _assertCompilationUnitMatches(true, r''' | 552 _assertCompilationUnitMatches(true, r''' |
| 461 class A<T> {} | 553 class A<T> {} |
| 462 ''', r''' | 554 ''', r''' |
| 463 class A<T> {} | 555 class A<T> {} |
| 464 '''); | 556 '''); |
| 465 } | 557 } |
| 466 | 558 |
| 559 void test_true_classTypeAlias_list_reorder() { |
| 560 _assertCompilationUnitMatches(true, r''' |
| 561 class M {} |
| 562 class A = Object with M; |
| 563 class B = Object with M; |
| 564 class C = Object with M; |
| 565 ''', r''' |
| 566 class M {} |
| 567 class C = Object with M; |
| 568 class A = Object with M; |
| 569 class B = Object with M; |
| 570 '''); |
| 571 } |
| 572 |
| 573 void test_true_classTypeAlias_list_same() { |
| 574 _assertCompilationUnitMatches(true, r''' |
| 575 class M {} |
| 576 class A = Object with M; |
| 577 class B = Object with M; |
| 578 class C = Object with M; |
| 579 ''', r''' |
| 580 class M {} |
| 581 class A = Object with M; |
| 582 class B = Object with M; |
| 583 class C = Object with M; |
| 584 '''); |
| 585 } |
| 586 |
| 587 void test_true_classTypeAlias_typeParameters_same() { |
| 588 _assertCompilationUnitMatches(true, r''' |
| 589 class M<T> {} |
| 590 class A<T> {} |
| 591 class B<T> = A<T> with M<T>; |
| 592 ''', r''' |
| 593 class M<T> {} |
| 594 class A<T> {} |
| 595 class B<T> = A<T> with M<T>; |
| 596 '''); |
| 597 } |
| 598 |
| 467 void test_true_constructor_named_same() { | 599 void test_true_constructor_named_same() { |
| 468 _assertCompilationUnitMatches(true, r''' | 600 _assertCompilationUnitMatches(true, r''' |
| 469 class A { | 601 class A { |
| 470 A.name(int p); | 602 A.name(int p); |
| 471 } | 603 } |
| 472 ''', r''' | 604 ''', r''' |
| 473 class A { | 605 class A { |
| 474 A.name(int p); | 606 A.name(int p); |
| 475 } | 607 } |
| 476 '''); | 608 '''); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 503 class A { | 635 class A { |
| 504 A(int p); | 636 A(int p); |
| 505 } | 637 } |
| 506 ''', r''' | 638 ''', r''' |
| 507 class A { | 639 class A { |
| 508 A(int p); | 640 A(int p); |
| 509 } | 641 } |
| 510 '''); | 642 '''); |
| 511 } | 643 } |
| 512 | 644 |
| 645 void test_true_enum_constants_reorder() { |
| 646 resetWithEnum(); |
| 647 _assertCompilationUnitMatches(true, r''' |
| 648 enum E {A, B, C} |
| 649 ''', r''' |
| 650 enum E {C, A, B} |
| 651 '''); |
| 652 } |
| 653 |
| 654 void test_true_enum_list_reorder() { |
| 655 resetWithEnum(); |
| 656 _assertCompilationUnitMatches(true, r''' |
| 657 enum A {A1, A2, A3} |
| 658 enum B {B1, B2, B3} |
| 659 enum C {C1, C2, C3} |
| 660 ''', r''' |
| 661 enum C {C1, C2, C3} |
| 662 enum A {A1, A2, A3} |
| 663 enum B {B1, B2, B3} |
| 664 '''); |
| 665 } |
| 666 |
| 667 void test_true_enum_list_same() { |
| 668 resetWithEnum(); |
| 669 _assertCompilationUnitMatches(true, r''' |
| 670 enum A {A1, A2, A3} |
| 671 enum B {B1, B2, B3} |
| 672 enum C {C1, C2, C3} |
| 673 ''', r''' |
| 674 enum A {A1, A2, A3} |
| 675 enum B {B1, B2, B3} |
| 676 enum C {C1, C2, C3} |
| 677 '''); |
| 678 } |
| 679 |
| 513 void test_true_executable_same_hasLabel() { | 680 void test_true_executable_same_hasLabel() { |
| 514 _assertCompilationUnitMatches(true, r''' | 681 _assertCompilationUnitMatches(true, r''' |
| 515 main() { | 682 main() { |
| 516 label: return 42; | 683 label: return 42; |
| 517 } | 684 } |
| 518 ''', r''' | 685 ''', r''' |
| 519 main() { | 686 main() { |
| 520 label: return 42; | 687 label: return 42; |
| 521 } | 688 } |
| 522 '''); | 689 '''); |
| (...skipping 1352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1875 _visitList(node.metadata, other.metadata); | 2042 _visitList(node.metadata, other.metadata); |
| 1876 _visitNode(node.identifier, other.identifier); | 2043 _visitNode(node.identifier, other.identifier); |
| 1877 } | 2044 } |
| 1878 | 2045 |
| 1879 static void assertSameResolution(CompilationUnit actual, | 2046 static void assertSameResolution(CompilationUnit actual, |
| 1880 CompilationUnit expected) { | 2047 CompilationUnit expected) { |
| 1881 _SameResolutionValidator validator = new _SameResolutionValidator(expected); | 2048 _SameResolutionValidator validator = new _SameResolutionValidator(expected); |
| 1882 actual.accept(validator); | 2049 actual.accept(validator); |
| 1883 } | 2050 } |
| 1884 } | 2051 } |
| OLD | NEW |