Skip to content

Commit

Permalink
Fix extension type import library
Browse files Browse the repository at this point in the history
Closes #56781

Fixes #55443

GitOrigin-RevId: b6d7b3d
Change-Id: I708da5d01ccae45cc7d143e4fac365fb2c84e31e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/386701
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
  • Loading branch information
FMorschel authored and Commit Queue committed Sep 30, 2024
1 parent bdece53 commit 7b502b1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ class ImportLibrary extends MultiCorrectionProducer {
return await _importLibraryForElement(typeName, const [
ElementKind.CLASS,
ElementKind.ENUM,
ElementKind.EXTENSION_TYPE,
ElementKind.FUNCTION_TYPE_ALIAS,
ElementKind.MIXIN,
ElementKind.TYPE_ALIAS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,22 @@ void f() {
''');
}

Future<void> test_extensionType_name_notImported() async {
newFile('$testPackageLibPath/lib.dart', '''
extension type ET(String it) {}
''');
await resolveTestCode('''
void f(ET s) {
}
''');
await assertHasFix('''
import 'package:test/lib.dart';
void f(ET s) {
}
''');
}

Future<void> test_extensionType_notImported() async {
newFile('$testPackageLibPath/lib.dart', '''
extension type ET(String it) {}
Expand Down

0 comments on commit 7b502b1

Please sign in to comment.