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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/test/src/task/dart_test.dart
diff --git a/pkg/analyzer/test/src/task/dart_test.dart b/pkg/analyzer/test/src/task/dart_test.dart
index 2a66ec36b9a11bc07f7d3883f34574b5a6801816..09d71ad387d48fdf969dc604b61406c933c60729 100644
--- a/pkg/analyzer/test/src/task/dart_test.dart
+++ b/pkg/analyzer/test/src/task/dart_test.dart
@@ -1427,6 +1427,62 @@ library my_lib1;
expect(outputs[LIBRARY_CYCLE], hasLength(1));
}
+ void test_library_cycle_override_inference_incremental() {
+ enableStrongMode();
+ Source lib1Source = newSource(
+ '/my_lib1.dart',
+ '''
+library my_lib1;
+import 'my_lib3.dart';
+''');
+ Source lib2Source = newSource(
+ '/my_lib2.dart',
+ '''
+library my_lib2;
+import 'my_lib1.dart';
+''');
+ Source lib3Source = newSource(
+ '/my_lib3.dart',
+ '''
+library my_lib3;
+import 'my_lib2.dart';
+
+class A {
+ int foo(int x) => null;
+}
+class B extends A {
+ foo(x) => null;
+}
+''');
+ AnalysisTarget lib1Target = new LibrarySpecificUnit(lib1Source, lib1Source);
+ AnalysisTarget lib2Target = new LibrarySpecificUnit(lib2Source, lib2Source);
+ AnalysisTarget lib3Target = new LibrarySpecificUnit(lib3Source, lib3Source);
+
+ computeResult(lib1Target, RESOLVED_UNIT);
+ computeResult(lib2Target, RESOLVED_UNIT);
+ computeResult(lib3Target, RESOLVED_UNIT);
+ CompilationUnit unit = outputs[RESOLVED_UNIT];
+ ClassElement b = unit.declarations[1].element;
+ expect(b.getMethod('foo').returnType.toString(), 'int');
+
+ // add a dummy edit.
+ context.setContents(
+ lib1Source,
+ '''
+library my_lib1;
+import 'my_lib3.dart';
+var foo = 123;
+''');
+
+ computeResult(lib1Target, RESOLVED_UNIT);
+ computeResult(lib2Target, RESOLVED_UNIT);
+ computeResult(lib3Target, RESOLVED_UNIT);
+ unit = outputs[RESOLVED_UNIT];
+ b = unit.declarations[1].element;
+ expect(b.getMethod('foo').returnType.toString(), 'int',
+ reason: 'edit should not affect member inference');
+ }
+
void test_library_cycle_incremental_partial() {
enableStrongMode();
Source lib1Source = newSource(
« 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