Skip to content

Commit 7b502b1

Browse files
FMorschelCommit Queue
authored and
Commit Queue
committed
Fix extension type import library
Closes #56781 Fixes #55443 GitOrigin-RevId: b6d7b3d Change-Id: I708da5d01ccae45cc7d143e4fac365fb2c84e31e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386701 Commit-Queue: Samuel Rawlins <[email protected]> Reviewed-by: Konstantin Shcheglov <[email protected]> Reviewed-by: Samuel Rawlins <[email protected]>
1 parent bdece53 commit 7b502b1

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

pkg/analysis_server/lib/src/services/correction/dart/import_library.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,7 @@ class ImportLibrary extends MultiCorrectionProducer {
380380
return await _importLibraryForElement(typeName, const [
381381
ElementKind.CLASS,
382382
ElementKind.ENUM,
383+
ElementKind.EXTENSION_TYPE,
383384
ElementKind.FUNCTION_TYPE_ALIAS,
384385
ElementKind.MIXIN,
385386
ElementKind.TYPE_ALIAS,

pkg/analysis_server/test/src/services/correction/fix/import_library_project_test.dart

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,22 @@ void f() {
305305
''');
306306
}
307307

308+
Future<void> test_extensionType_name_notImported() async {
309+
newFile('$testPackageLibPath/lib.dart', '''
310+
extension type ET(String it) {}
311+
''');
312+
await resolveTestCode('''
313+
void f(ET s) {
314+
}
315+
''');
316+
await assertHasFix('''
317+
import 'package:test/lib.dart';
318+
319+
void f(ET s) {
320+
}
321+
''');
322+
}
323+
308324
Future<void> test_extensionType_notImported() async {
309325
newFile('$testPackageLibPath/lib.dart', '''
310326
extension type ET(String it) {}

0 commit comments

Comments
 (0)