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

Unified Diff: pkg/analyzer/test/generated/compile_time_error_code_test.dart

Issue 1743523003: Clear the element for imports and exports when the target doesn't exist. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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/generated/compile_time_error_code_test.dart
diff --git a/pkg/analyzer/test/generated/compile_time_error_code_test.dart b/pkg/analyzer/test/generated/compile_time_error_code_test.dart
index 50ea5db63d460f2b9e6662671b0ca5693bf5c256..09485aa27b523533241ba22b2e3292b430c8963e 100644
--- a/pkg/analyzer/test/generated/compile_time_error_code_test.dart
+++ b/pkg/analyzer/test/generated/compile_time_error_code_test.dart
@@ -12,6 +12,7 @@ import 'package:unittest/unittest.dart' show expect;
import '../reflective_tests.dart';
import '../utils.dart';
import 'resolver_test.dart';
+import 'package:analyzer/src/generated/engine.dart';
main() {
initializeTestEnvironment();
@@ -6044,7 +6045,7 @@ main() {
assertErrors(source, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]);
}
- void test_uriDoesNotExist_import_then_fixed() {
+ void test_uriDoesNotExist_import_disappears_when_fixed() {
Source source = addSource("import 'target.dart';");
computeLibrarySourceErrors(source);
assertErrors(source, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]);
@@ -6060,11 +6061,25 @@ main() {
..handleContentsChanged(target, null, "", true);
// Make sure the error goes away.
- // TODO(skybrian) why isn't there an unused import hint?
computeLibrarySourceErrors(source);
assertErrors(source, [HintCode.UNUSED_IMPORT]);
}
+ void test_uriDoesNotExist_import_appears_after_deleting_target() {
+ Source test = addSource("import 'target.dart';");
+ Source target = addNamedSource("/target.dart", "");
+ computeLibrarySourceErrors(test);
+ assertErrors(test, [HintCode.UNUSED_IMPORT]);
+
+ // Remove the overlay in the same way as AnalysisServer.
+ analysisContext2.setContents(target, null);
+ ChangeSet changeSet = new ChangeSet()..removedSource(target);
+ analysisContext2.applyChanges(changeSet);
+
+ computeLibrarySourceErrors(test);
+ assertErrors(test, [CompileTimeErrorCode.URI_DOES_NOT_EXIST]);
+ }
+
void test_uriDoesNotExist_part() {
Source source = addSource(r'''
library lib;

Powered by Google App Engine
This is Rietveld 408576698