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

Side by Side Diff: pkg/analyzer/test/src/task/dart_test.dart

Issue 1513143004: fix #25171, clear "hasBeenInferred" flag when re-running resolution (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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.src.task.dart_test; 5 library analyzer.test.src.task.dart_test;
6 6
7 import 'package:analyzer/src/context/cache.dart'; 7 import 'package:analyzer/src/context/cache.dart';
8 import 'package:analyzer/src/generated/ast.dart'; 8 import 'package:analyzer/src/generated/ast.dart';
9 import 'package:analyzer/src/generated/constant.dart'; 9 import 'package:analyzer/src/generated/constant.dart';
10 import 'package:analyzer/src/generated/element.dart'; 10 import 'package:analyzer/src/generated/element.dart';
(...skipping 1409 matching lines...) Expand 10 before | Expand all | Expand 10 after
1420 library my_lib1; 1420 library my_lib1;
1421 '''); 1421 ''');
1422 computeResult(lib1Target, LIBRARY_CYCLE); 1422 computeResult(lib1Target, LIBRARY_CYCLE);
1423 expect(outputs[LIBRARY_CYCLE], hasLength(1)); 1423 expect(outputs[LIBRARY_CYCLE], hasLength(1));
1424 computeResult(lib2Target, LIBRARY_CYCLE); 1424 computeResult(lib2Target, LIBRARY_CYCLE);
1425 expect(outputs[LIBRARY_CYCLE], hasLength(1)); 1425 expect(outputs[LIBRARY_CYCLE], hasLength(1));
1426 computeResult(lib3Target, LIBRARY_CYCLE); 1426 computeResult(lib3Target, LIBRARY_CYCLE);
1427 expect(outputs[LIBRARY_CYCLE], hasLength(1)); 1427 expect(outputs[LIBRARY_CYCLE], hasLength(1));
1428 } 1428 }
1429 1429
1430 void test_library_cycle_override_inference_incremental() {
1431 enableStrongMode();
1432 Source lib1Source = newSource(
1433 '/my_lib1.dart',
1434 '''
1435 library my_lib1;
1436 import 'my_lib3.dart';
1437 ''');
1438 Source lib2Source = newSource(
1439 '/my_lib2.dart',
1440 '''
1441 library my_lib2;
1442 import 'my_lib1.dart';
1443 ''');
1444 Source lib3Source = newSource(
1445 '/my_lib3.dart',
1446 '''
1447 library my_lib3;
1448 import 'my_lib2.dart';
1449
1450 class A {
1451 int foo(int x) => null;
1452 }
1453 class B extends A {
1454 foo(x) => null;
1455 }
1456 ''');
1457 AnalysisTarget lib1Target = new LibrarySpecificUnit(lib1Source, lib1Source);
1458 AnalysisTarget lib2Target = new LibrarySpecificUnit(lib2Source, lib2Source);
1459 AnalysisTarget lib3Target = new LibrarySpecificUnit(lib3Source, lib3Source);
1460
1461 computeResult(lib1Target, RESOLVED_UNIT);
1462 computeResult(lib2Target, RESOLVED_UNIT);
1463 computeResult(lib3Target, RESOLVED_UNIT);
1464 CompilationUnit unit = outputs[RESOLVED_UNIT];
1465 ClassElement b = unit.declarations[1].element;
1466 expect(b.getMethod('foo').returnType.toString(), 'int');
1467
1468 // add a dummy edit.
1469 context.setContents(
1470 lib1Source,
1471 '''
1472 library my_lib1;
1473 import 'my_lib3.dart';
1474 var foo = 123;
1475 ''');
1476
1477 computeResult(lib1Target, RESOLVED_UNIT);
1478 computeResult(lib2Target, RESOLVED_UNIT);
1479 computeResult(lib3Target, RESOLVED_UNIT);
1480 unit = outputs[RESOLVED_UNIT];
1481 b = unit.declarations[1].element;
1482 expect(b.getMethod('foo').returnType.toString(), 'int',
1483 reason: 'edit should not affect member inference');
1484 }
1485
1430 void test_library_cycle_incremental_partial() { 1486 void test_library_cycle_incremental_partial() {
1431 enableStrongMode(); 1487 enableStrongMode();
1432 Source lib1Source = newSource( 1488 Source lib1Source = newSource(
1433 '/my_lib1.dart', 1489 '/my_lib1.dart',
1434 ''' 1490 '''
1435 library my_lib1; 1491 library my_lib1;
1436 '''); 1492 ''');
1437 Source lib2Source = newSource( 1493 Source lib2Source = newSource(
1438 '/my_lib2.dart', 1494 '/my_lib2.dart',
1439 ''' 1495 '''
(...skipping 3128 matching lines...) Expand 10 before | Expand all | Expand 10 after
4568 /** 4624 /**
4569 * Fill [errorListener] with [result] errors in the current [task]. 4625 * Fill [errorListener] with [result] errors in the current [task].
4570 */ 4626 */
4571 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) { 4627 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) {
4572 List<AnalysisError> errors = task.outputs[result]; 4628 List<AnalysisError> errors = task.outputs[result];
4573 expect(errors, isNotNull, reason: result.name); 4629 expect(errors, isNotNull, reason: result.name);
4574 errorListener = new GatheringErrorListener(); 4630 errorListener = new GatheringErrorListener();
4575 errorListener.addAll(errors); 4631 errorListener.addAll(errors);
4576 } 4632 }
4577 } 4633 }
OLDNEW
« pkg/analyzer/lib/src/generated/resolver.dart ('K') | « pkg/analyzer/lib/src/generated/resolver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698