Skip to content

Rename prefix needs better handling on shadowing names #61199

@FMorschel

Description

@FMorschel

Based on both:

I'd started working on https://dart-review.googlesource.com/c/sdk/+/421543. I'll leave that one for creating the new actions, but it was stale because while developing it I found out that the rename prefix really needs some attention on shadowing, it has basically nothing today (both for removing the name entirely and adding a new name that shadows another declaration).

So this issue is intended to track only the handling of shadowing names when renaming the prefix. I'll remove the work on this that I had started on that CL (last patchset to have this was 4), and later I might come back to this, but if anyone knows better how to handle this and wants to jump on it before I do, please feel completely free to do so.

Here are some examples of tests I had added:

import 'dart:core'; //Try adding `core`

void f() {
  var core = 42;
  print(core);
}
import 'dart:core' as c^ore;

// Maybe try importing and using too
void print(String s) {}

void f() {
  print('Hello, world!');
  core.print('Hello, world!');
}

FYI @bwilkerson

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2A bug or feature request we're likely to work onarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-refactoringIssues with analysis server refactoringstype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions