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

Unified Diff: pkg/analyzer/test/src/task/dart_test.dart

Issue 1524893002: Fix imports within the analyzer package (Closed) Base URL: https://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 669b909258a07fc0a3e9022e043b2931a842ee40..fd4fee224db9f1cb3136abcb1b00417dd3562528 100644
--- a/pkg/analyzer/test/src/task/dart_test.dart
+++ b/pkg/analyzer/test/src/task/dart_test.dart
@@ -4,10 +4,12 @@
library analyzer.test.src.task.dart_test;
+import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/dart/element/type.dart';
import 'package:analyzer/src/context/cache.dart';
+import 'package:analyzer/src/dart/element/element.dart';
import 'package:analyzer/src/generated/ast.dart';
import 'package:analyzer/src/generated/constant.dart';
-import 'package:analyzer/src/generated/element.dart';
import 'package:analyzer/src/generated/engine.dart'
show AnalysisOptionsImpl, CacheState;
import 'package:analyzer/src/generated/error.dart';
@@ -1429,62 +1431,6 @@ 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(
@@ -1594,6 +1540,62 @@ import 'a.dart';
expect(dep2, hasLength(1)); // dart:core
}
+ 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_self_loop() {
List<Source> sources = newSources({
'/a.dart': '''
« no previous file with comments | « pkg/analyzer/test/src/summary/summary_test.dart ('k') | pkg/analyzer/test/src/task/incremental_element_builder_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698