quick fix for `IMPORT_OF_NON_LIBRARY` Change-Id: Ib7e6a72e61631d6c2a3056e793ccf7e0a3b44b78 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/367144 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Phil Quitslund <pquitslund@google.com>
diff --git a/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml b/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml index 048837b..b00fc4e 100644 --- a/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml +++ b/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml
@@ -840,9 +840,7 @@ CompileTimeErrorCode.IMPORT_INTERNAL_LIBRARY: status: hasFix CompileTimeErrorCode.IMPORT_OF_NON_LIBRARY: - status: needsFix - notes: |- - Remove the import. + status: hasFix CompileTimeErrorCode.IMPORT_OF_NOT_AUGMENTATION: status: needsFix notes: |-
diff --git a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart index df151bf..f8fc4dc 100644 --- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart +++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
@@ -992,6 +992,9 @@ CompileTimeErrorCode.IMPLICIT_SUPER_INITIALIZER_MISSING_ARGUMENTS: [ AddSuperParameter.new, ], + CompileTimeErrorCode.IMPORT_OF_NON_LIBRARY: [ + RemoveUnusedImport.new, + ], CompileTimeErrorCode.IMPORT_INTERNAL_LIBRARY: [ RemoveUnusedImport.new, ],
diff --git a/pkg/analysis_server/test/src/services/correction/fix/remove_unused_import_test.dart b/pkg/analysis_server/test/src/services/correction/fix/remove_unused_import_test.dart index dc35d53..70c02480 100644 --- a/pkg/analysis_server/test/src/services/correction/fix/remove_unused_import_test.dart +++ b/pkg/analysis_server/test/src/services/correction/fix/remove_unused_import_test.dart
@@ -219,6 +219,17 @@ '''); } + Future<void> test_importOfNonLibrary() async { + newFile('$testPackageLibPath/part.dart', r''' +part of lib; +'''); + await resolveTestCode(r''' +import 'part.dart'; +'''); + await assertHasFix(''' +'''); + } + test_internalLibraryImport() async { await resolveTestCode(''' import 'dart:_internal';