Property rename refactoring doesn't rename auto-synthesized instance variables
| Originator: | jonsterling |
|
| Number: | rdar://12008280 |
Date Originated: | 01-Aug-2012 12:05 PM |
| Status: | Open |
Resolved: | |
| Product: | Developer Tools |
Product Version: | 4.4 |
| Classification: | |
Reproducible: | Always |
# Summary:
When renaming a property using Xcode's refactoring tool, instance
variables that were automatically synthesized are not renamed.
# Steps to Reproduce:
Make a simple class with a property, and allow a backing instance
variable to be automatically synthesized.
@interface Dog : NSObject
@property (copy) NSString *name;
@end
@implementation Dog
- (void)dealloc {
[_name release];
}
@end
Now, rename `name` to `nickname` using the refactoring tool.
# Expected Results:
@interface Dog : NSObject
@property (copy) NSString *nickname;
@end
@implementation Dog
- (void)dealloc {
[_nickname release];
}
@end
# Actual Results:
@interface Dog : NSObject
@property (copy) NSString *nickname;
@end
@implementation Dog
- (void)dealloc {
[_name release]; <<< COMPILE ERROR: undefined identifier _name
}
@end
# Notes:
If an instance variable is in use, and the compiler can tell that it is
synthesized by the property in question, it should be renamed at the
same time as the property according to the rules that are used for
autosynthesis.
Duplicates
Comments
ag9zfm9wZW5yYWRhci1ocmRyDQsSBVJhZGFyGL7wcAw
Please note:
Reports posted here will not necessarily be seen by Apple.
All problems should be submitted at bugreport.apple.com before they are posted here.
Please only post information for Radars that you have filed yourself, and please do
not include Apple confidential information in your posts. Thank you!