Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/IDE/Refactoring/Change Parameters    [ Add a report in this area ]  
Report #:  57410   Status: Closed
Problem with refactoring - ChangeParameters
Project:  Delphi Build #:  11.0.2902.10471
Version:    11.2 Submitted By:   Richard Dermont
Report Type:  Basic functionality failure Date Reported:  1/24/2008 11:19:59 AM
Severity:    Infrequently encountered problem Last Updated: 3/20/2012 2:24:39 AM
Platform:    All platforms Internal Tracking #:   257420
Resolution: Duplicate (Resolution Comments) Resolved in Build: : 11.0.2804.9245
Duplicate of:  30767
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
Description
I have one parameter in a method. I want to change it to a different type. I go to Change Parameters and the edit button is disabled. I remove the parameter. The result is a method with empty brackets following. I go to change parameters again and add my changed parameter. I get a function with two sets of brackets, one of them empty. Does not compile of course.
Steps to Reproduce:
Original Unit

unit ChangeParams57410U;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm2 = class(TForm)
    procedure FormShow(Sender: TObject);
  private
    procedure AProc(I: Integer);
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

{$R *.dfm}

procedure TForm2.AProc(I: Integer);
begin
  ShowMessage('OK');
end;

procedure TForm2.FormShow(Sender: TObject);
begin
{
  Remove next line so that program is not in
  error after change (I don't know that it
   matters. I get the same result.
}
//  AProc(3);
end;

end.

Use change parameters refactoring to remove parameter in AProc.

Result

unit ChangeParams57410U;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm2 = class(TForm)
    procedure FormShow(Sender: TObject);
  private
    //Unusual but compiles OK
    procedure AProc();
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

{$R *.dfm}

procedure TForm2.AProc();
begin
  ShowMessage('OK');
end;

procedure TForm2.FormShow(Sender: TObject);
begin
//  AProc(3);
end;

end.

Use change parameters refactoring to add parameter S: String

Result

unit ChangeParams57410U;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm2 = class(TForm)
    procedure FormShow(Sender: TObject);
  private
    // The double brackets are of course an error
    procedure AProc(S: string)();
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

{$R *.dfm}

procedure TForm2.AProc(S: string)();
begin
  ShowMessage('OK');
end;

procedure TForm2.FormShow(Sender: TObject);
begin
//  AProc(3);
end;

end.
Workarounds
None
Attachment
None
Comments

Francois Piette (OverByte) at 1/27/2008 11:09:17 AM -
I'm not sure I correctly understand what the issue is !
Would you add detailed steps ? If needed, add screen shots to show what the issue really is.

Server Response from: ETNACODE01