Bug in refactoring in XE5.

Bug in refactoring in XE5.  
Can someone check this in XE6 and report if still an issue?

Use refactoring to rename constant CreateStoragePos to f.x. CreateStorage.

Result:  reference in attribute
    [TestCase('Create', CreateStoragePos, NoSep)]
will not be renamed.

{code}
unit DUnitX_PSDStorage;
interface
uses
  DUnitX_PSDBase, PSDConstants, PSDStorage,
  DUnitX.TestFramework;

const
  CreateStoragePos = String('something');
  ModifyStoragePos = String('something');
type

  [TestFixture]
  TestTPSDStorageArea= class(TTestClass)
  public
    [Setup]
    procedure Setup; override;
    [TearDown]
    procedure TearDown; override;
    [Test]
    [TestCase('Create', CreateStoragePos, NoSep)]
    procedure CreateFromJSON(const aJSON: String); override;
    [Test]
    function SaveToDB:TPSDResult; override;
    [Test]
    function ReadFromDb:TPSDResult; override;
    [Test]
    [TestCase('Modify', ModifyStoragePos, NoSep)]
    function ChangeAndSave(const aJSON: String):TPSDResult; override;
    [Test]
    function DeleteFromDb:TPSDResult; override;
  end;
{code}

Comments

  1. XE6: the attribute isn't changed.  (Note my refactoring may be affected by not having the DUnitX code installed & available, so the unit won't compile. That tends to affect Delphi's refactoring.)

    ReplyDelete
  2. Clean unit

    {code}
    unit AttribParamRefactoring;

    interface

    const
      // Use refactoring to rename aStrConst
      aStrConst = String('Some constant');

    type
      MyAttrib = class(TCustomAttribute)
      private
        FParam: String;
      public
        constructor Create(const aParam: String);
     end;

    type
      TMyObject = class
      private
        FSomeProperty: Integer;
        procedure SetSomeProperty(const Value: Integer);
      public
      // aStrConst reference in attribute is not renamed
       [MyAttrib(aStrConst)]
       property SomeProperty:Integer read FSomeProperty write SetSomeProperty;
      end;

    implementation

    { MyAttrib }

    constructor MyAttrib.Create(const aParam: String);
    begin
      FParam := aParam;
    end;

    { TMyObject }

    procedure TMyObject.SetSomeProperty(const Value: Integer);
    begin
      FSomeProperty := Value;
    end;

    end.
    {code}

    ReplyDelete
  3. Lars Fosdal rename `aStrConst` fails in XE6.

    ReplyDelete

Post a Comment