On Thursday, 19 April 2012 at 12:31:24 UTC, Tobias Pankrath wrote:
T foo(T)(T x) {
return x.something();
}
int something(int x) {
return 1;
}
float something(float x) {
return 1.0;
}
Now... go and rename the first function named "something".
What do you do with "x.something()" inside the template...
rename it or not?
1. Ask the user or
2. Check if there is an instance of foo!int which refers to
something. If so
and there is no other instance, that refers to another
something: rename it.
3. If there in another instance: Ask the user to rename one,
all, none.
I would go ReSharper way: present user a tree with all
occurrences of related symbols and checkboxes to include or
exclude each. Or, in this particular case, display a list of
affected types and checkboxes for each. This isn't VERY user
friendly, though, but very flexible and reasonable. Give warnings
if necessary.
Semantic analysis phase would provide information whether symbol
is actually related, or only has the same name (but different
semantics and scope).