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

Unified Diff: pkg/analyzer/test/src/summary/resynthesize_test.dart

Issue 1910343002: Fix summary resynthesis in the event of a self-import. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/test/src/summary/resynthesize_test.dart
diff --git a/pkg/analyzer/test/src/summary/resynthesize_test.dart b/pkg/analyzer/test/src/summary/resynthesize_test.dart
index 5b4f8edf155dc95b2c6e273a61de973a20e63b58..5013a150b86ee35804d4ef3d5d497049e765add2 100644
--- a/pkg/analyzer/test/src/summary/resynthesize_test.dart
+++ b/pkg/analyzer/test/src/summary/resynthesize_test.dart
@@ -1212,7 +1212,7 @@ abstract class AbstractResynthesizeTest extends AbstractSingleUnitTest {
@reflectiveTest
class ResynthesizeElementTest extends ResynthesizeTest {
@override
- void checkLibrary(String text,
+ LibraryElementImpl checkLibrary(String text,
{bool allowErrors: false, bool dumpSummaries: false}) {
Source source = addTestSource(text);
LibraryElementImpl original = context.computeLibraryElement(source);
@@ -1222,6 +1222,7 @@ class ResynthesizeElementTest extends ResynthesizeTest {
source.uri.toString(),
original);
checkLibraryElements(original, resynthesized);
+ return resynthesized;
}
@override
@@ -1317,7 +1318,7 @@ class ResynthesizeElementTest extends ResynthesizeTest {
@reflectiveTest
abstract class ResynthesizeTest extends AbstractResynthesizeTest {
- void checkLibrary(String text,
+ LibraryElementImpl checkLibrary(String text,
{bool allowErrors: false, bool dumpSummaries: false});
/**
@@ -3165,6 +3166,18 @@ get x => null;''');
checkLibrary('import "a.dart" as a; a.C c;');
}
+ test_import_self() {
+ LibraryElementImpl resynthesized = checkLibrary('''
+import 'test.dart' as p;
+class C {}
+class D extends p.C {} // Prevent "unused import" warning
+''');
+ expect(resynthesized.imports, hasLength(2));
+ expect(resynthesized.imports[0].importedLibrary.location,
+ resynthesized.location);
+ expect(resynthesized.imports[1].importedLibrary.isDartCore, true);
+ }
+
test_import_show() {
addLibrary('dart:async');
checkLibrary('''
« no previous file with comments | « pkg/analyzer/test/src/summary/resynthesize_ast_test.dart ('k') | pkg/analyzer/test/src/summary/summary_common.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698