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

Number Status Originator Product Title
rdar://12122448 Duplicate/12008280 syncluz Developer Tools (XCode) XCode refactoring: rename of autosynthesized properties does not rename ivar
rdar://12225850 Duplicate/12008280 TheCocoaNaut Developer Tools Refactoring of property names doesn't rename the corresponding ivar

Comments


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!