Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 refactor->rename wrong behavior
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Voivoid
New Member

Russia
6 Posts

Posted - Sep 10 2013 :  02:34:28 AM  Show Profile  Reply with Quote
Consider the following code:

static const int val = 42;
int main() {
  int tmp = val;
  int val = 0;  
  return val;
}

Move cursor to the line 'return val;'. Try refactor-rename to rename 'val' variable. 'int tmp = val' line changes though it should not.
static const int val = 42;
int main() {
  int tmp = val_new;
  int val_new = 0;  
  return val_new;
}


VA 10.7.1949.0

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Sep 10 2013 :  5:34:44 PM  Show Profile  Reply with Quote
I am seeing the same effect here. Thank you for the clear description.

case=3414
Go to Top of Page

Voivoid
New Member

Russia
6 Posts

Posted - Sep 12 2013 :  08:27:41 AM  Show Profile  Reply with Quote
A few more cases:

int main() {
  int n = 0;
  for( int n = 0; n < 10; ++n ) {
  }
  ++n;
  return 0;
}

1) Move cursor to
int n = 0
Try to rename 'n'. The following line changes though it should not
for( int n = 0; n < 10; ++n ) {


2) Move cursor to
for( int n = 0; n < 10; ++n ) {
Try to rename 'n'. The following line changes though it should not
int n = 0

Edited by - Voivoid on Sep 12 2013 08:28:14 AM
Go to Top of Page

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Sep 12 2013 :  2:21:41 PM  Show Profile  Reply with Quote
Basically, when you define an outer and inner scope variable with the same name, it always fails, I mentioned the cases in the bug report.
Thank you for the sample, though.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000