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

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

Issue 1620453002: Disable incremental resolution for constructor parameter names changes. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/analyzer/lib/src/generated/incremental_resolver.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library analyzer.test.generated.incremental_resolver_test; 5 library analyzer.test.generated.incremental_resolver_test;
6 6
7 import 'package:analyzer/dart/ast/ast.dart'; 7 import 'package:analyzer/dart/ast/ast.dart';
8 import 'package:analyzer/dart/element/element.dart'; 8 import 'package:analyzer/dart/element/element.dart';
9 import 'package:analyzer/src/context/cache.dart'; 9 import 'package:analyzer/src/context/cache.dart';
10 import 'package:analyzer/src/dart/ast/utilities.dart'; 10 import 'package:analyzer/src/dart/ast/utilities.dart';
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 A(int p); 489 A(int p);
490 } 490 }
491 ''', 491 ''',
492 r''' 492 r'''
493 class A { 493 class A {
494 A(); 494 A();
495 } 495 }
496 '''); 496 ''');
497 } 497 }
498 498
499 void test_false_constructor_parameters_name() {
500 _assertDoesNotMatch(
501 r'''
502 class A {
503 A(int a);
504 }
505 ''',
506 r'''
507 class A {
508 A(int b);
509 }
510 ''');
511 }
512
499 void test_false_constructor_parameters_type_edit() { 513 void test_false_constructor_parameters_type_edit() {
500 _assertDoesNotMatch( 514 _assertDoesNotMatch(
501 r''' 515 r'''
502 class A { 516 class A {
503 A(int p); 517 A(int p);
504 } 518 }
505 ''', 519 ''',
506 r''' 520 r'''
507 class A { 521 class A {
508 A(String p); 522 A(String p);
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 } 843 }
830 ''', 844 ''',
831 r''' 845 r'''
832 class A { 846 class A {
833 final field; 847 final field;
834 A(this.field(a)); 848 A(this.field(a));
835 } 849 }
836 '''); 850 ''');
837 } 851 }
838 852
853 void test_false_fieldFormalParameter_changeName_wasUnresolvedField() {
854 _assertDoesNotMatch(
855 r'''
856 class A {
857 final fff;
858 A(this.unresolved);
859 }
860 ''',
861 r'''
862 class A {
863 final fff;
864 A(this.fff);
865 }
866 ''');
867 }
868
839 void test_false_fieldFormalParameter_differentField() { 869 void test_false_fieldFormalParameter_differentField() {
840 _assertDoesNotMatch( 870 _assertDoesNotMatch(
841 r''' 871 r'''
842 class A { 872 class A {
843 final aaa; 873 final aaa;
844 final bbb; 874 final bbb;
845 A(this.aaa, this.bbb); 875 A(this.aaa, this.bbb);
846 } 876 }
847 ''', 877 ''',
848 r''' 878 r'''
(...skipping 1651 matching lines...) Expand 10 before | Expand all | Expand 10 after
2500 } 2530 }
2501 ''', 2531 ''',
2502 r''' 2532 r'''
2503 class A { 2533 class A {
2504 int field; 2534 int field;
2505 A(this.field); 2535 A(this.field);
2506 } 2536 }
2507 '''); 2537 ''');
2508 } 2538 }
2509 2539
2510 void test_true_fieldFormalParameter_changeName_wasUnresolvedField() {
2511 _assertMatches(
2512 r'''
2513 class A {
2514 final fff;
2515 A(this.unresolved);
2516 }
2517 ''',
2518 r'''
2519 class A {
2520 final fff;
2521 A(this.fff);
2522 }
2523 ''');
2524 }
2525
2526 void test_true_fieldFormalParameter_function() { 2540 void test_true_fieldFormalParameter_function() {
2527 _assertMatches( 2541 _assertMatches(
2528 r''' 2542 r'''
2529 class A { 2543 class A {
2530 final field; 2544 final field;
2531 A(this.field(int a, String b)); 2545 A(this.field(int a, String b));
2532 } 2546 }
2533 ''', 2547 ''',
2534 r''' 2548 r'''
2535 class A { 2549 class A {
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after
3164 class A { 3178 class A {
3165 A(int p); 3179 A(int p);
3166 } 3180 }
3167 class B extends A { 3181 class B extends A {
3168 B(int a, int b) : super(a + b); 3182 B(int a, int b) : super(a + b);
3169 } 3183 }
3170 '''); 3184 ''');
3171 _resolve(_editString('+', '*'), _isExpression); 3185 _resolve(_editString('+', '*'), _isExpression);
3172 } 3186 }
3173 3187
3174 void test_fieldFormalParameter() {
3175 _resolveUnit(r'''
3176 class A {
3177 int xy;
3178 A(this.x);
3179 }''');
3180 _resolve(_editString('this.x', 'this.xy'), _isDeclaration);
3181 }
3182
3183 void test_function_localFunction_add() { 3188 void test_function_localFunction_add() {
3184 _resolveUnit(r''' 3189 _resolveUnit(r'''
3185 int main() { 3190 int main() {
3186 return 0; 3191 return 0;
3187 } 3192 }
3188 callIt(f) {} 3193 callIt(f) {}
3189 '''); 3194 ''');
3190 _resolve(_editString('return 0;', 'callIt((p) {});'), _isBlock); 3195 _resolve(_editString('return 0;', 'callIt((p) {});'), _isBlock);
3191 } 3196 }
3192 3197
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after
4099 } 4104 }
4100 } 4105 }
4101 4106
4102 bbb() { 4107 bbb() {
4103 print(0123456789); 4108 print(0123456789);
4104 } 4109 }
4105 }''', 4110 }''',
4106 expectedSuccess: false); 4111 expectedSuccess: false);
4107 } 4112 }
4108 4113
4114 void test_false_wholeConstructor() {
4115 _resolveUnit(r'''
4116 class A {
4117 A(int a) {
4118 print(a);
4119 }
4120 }
4121 ''');
4122 _updateAndValidate(
4123 r'''
4124 class A {
4125 A(int b) {
4126 print(b);
4127 }
4128 }
4129 ''',
4130 expectedSuccess: false);
4131 }
4132
4109 void test_fieldClassField_propagatedType() { 4133 void test_fieldClassField_propagatedType() {
4110 _resolveUnit(r''' 4134 _resolveUnit(r'''
4111 class A { 4135 class A {
4112 static const A b = const B(); 4136 static const A b = const B();
4113 const A(); 4137 const A();
4114 } 4138 }
4115 4139
4116 class B extends A { 4140 class B extends A {
4117 const B(); 4141 const B();
4118 } 4142 }
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
4321 print(2); 4345 print(2);
4322 } 4346 }
4323 foo() { 4347 foo() {
4324 // TODO 4348 // TODO
4325 } 4349 }
4326 '''); 4350 ''');
4327 List<AnalysisError> newErrors = analysisContext.computeErrors(source); 4351 List<AnalysisError> newErrors = analysisContext.computeErrors(source);
4328 _assertEqualErrors(newErrors, oldErrors); 4352 _assertEqualErrors(newErrors, oldErrors);
4329 } 4353 }
4330 4354
4331 void test_true_wholeConstructor() {
4332 _resolveUnit(r'''
4333 class A {
4334 A(int a) {
4335 print(a);
4336 }
4337 }
4338 ''');
4339 _updateAndValidate(r'''
4340 class A {
4341 A(int b) {
4342 print(b);
4343 }
4344 }
4345 ''');
4346 }
4347
4348 void test_true_wholeConstructor_addInitializer() { 4355 void test_true_wholeConstructor_addInitializer() {
4349 _resolveUnit(r''' 4356 _resolveUnit(r'''
4350 class A { 4357 class A {
4351 int field; 4358 int field;
4352 A(); 4359 A();
4353 } 4360 }
4354 '''); 4361 ''');
4355 _updateAndValidate(r''' 4362 _updateAndValidate(r'''
4356 class A { 4363 class A {
4357 int field; 4364 int field;
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after
5128 @override 5135 @override
5129 void logException(Object exception, [Object stackTrace]) { 5136 void logException(Object exception, [Object stackTrace]) {
5130 hasError = true; 5137 hasError = true;
5131 } 5138 }
5132 5139
5133 @override 5140 @override
5134 logging.LoggingTimer startTimer() { 5141 logging.LoggingTimer startTimer() {
5135 return new logging.LoggingTimer(this); 5142 return new logging.LoggingTimer(this);
5136 } 5143 }
5137 } 5144 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/incremental_resolver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698