Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 369335

Summary: Allow renaming of unresolved names
Product: [Tools] CDT Reporter: Marc-André Laperle <malaperle>
Component: cdt-refactoringAssignee: Project Inbox <cdt-refactoring-inbox>
Status: NEW --- QA Contact: Jonah Graham <jonah>
Severity: enhancement    
Priority: P3 CC: cdtdoug, yevshif
Version: 8.0.1   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Marc-André Laperle CLA 2012-01-22 12:52:05 EST
Using 8.0.1

int main() {
  foo(); //note that foo is not declared!
  return 0;
}

1. Initiate Rename refactoring on foo (alt+shift+r)
2. Rename foo to something else. Press enter.
3. Message is shown "The selected name cannot be renamed"

Instead, this message could be shown as soon as Rename is invoked (alt+shift+r).
Comment 1 Sergey Prigogin CLA 2012-01-22 17:24:31 EST
JDT is less strict in a situation like this and allows unresolved names to be renamed. It even renames other unresolved names that are somewhat similar:

class A {
}

class B {
  A a;
  void test() {
    a.foo();
    a.foo(1);
  }
}

JDT renames both instances of foo. We don't have to be as lax as JDT, but shouldn't be too strict either.
Comment 2 Marc-André Laperle CLA 2012-01-22 19:47:25 EST
Oh I didn't know JDT did that. I think we should try to do something similar, I'll change the title to reflect that.