Skip to content

Commit

Permalink
[DAS] Fixes different aliased imports same element
Browse files Browse the repository at this point in the history
[email protected]

Fixes #59584

Change-Id: I7038827ad0414e73e6af8f37f90d56cfcb6e76af
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/397000
Reviewed-by: Brian Wilkerson <[email protected]>
Commit-Queue: Samuel Rawlins <[email protected]>
Reviewed-by: Samuel Rawlins <[email protected]>
Auto-Submit: Felipe Morschel <[email protected]>
  • Loading branch information
FMorschel authored and Commit Queue committed Nov 22, 2024
1 parent de9f149 commit 81a7acc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ class ImportsHandler
for (var directive in unit.directives.whereType<ImportDirective>()) {
var import = directive.libraryImport;
if (import == null) continue;
var importPrefix = directive.prefix?.name;
if (importPrefix != prefix) continue;

var importedElement =
prefix == null
Expand Down
14 changes: 14 additions & 0 deletions pkg/analysis_server/test/lsp/import_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,20 @@ Rando^m? r;''');
);
}

Future<void> test_import_multiple() async {
await _verifyGoToImports(
TestCode.parse('''
import 'dart:async' as import1;
import 'dart:async' as import2;
/*[0*/import 'dart:async';/*0]*/
/*[1*/import 'dart:core';/*1]*/
import 'dart:math';
Futur^e<void>? f;
'''),
);
}

Future<void> test_import_part() async {
var otherFileUri = Uri.file(join(projectFolderPath, 'lib', 'other.dart'));
var main = TestCode.parse('''
Expand Down

0 comments on commit 81a7acc

Please sign in to comment.