On 15.01.2021 13:34, Mattias Gaertner via lazarus wrote:
Do you have a complete example unit (you can strip the statements and vars)?

See the attachment for two example units - obviously I cannot guarantee it is the same scenario that duilio experiences but it is definitely an example of Ctrl+Shift+C generating a duplicate method.

In general: if you delete a method A and add a method B to the interface whereas A and B are of different types ("class constructor" vs "constructor" vs "procedure/function") you get a duplicate.

I have known about this bug for a long time but have been too lazy to fix it :(


Do you use IFDEFs?

No.

Ondrej

unit Unit1;

{$mode objfpc}

interface

type
  TMyClass = class
  public
    procedure DoClick(Sender: TObject);
  end;

implementation

{ TMyClass }

constructor TMyClass.Create;
begin
  inherited Create;

  Writeln('Create');
end;

end.

unit Unit2;

{$mode objfpc}

interface

type
  TMyClass = class
  public
    class constructor Create;
  end;

implementation

{ TMyClass }

constructor TMyClass.Create;
begin
  inherited Create;

  Writeln('Create');
end;

end.

-- 
_______________________________________________
lazarus mailing list
[email protected]
https://lists.lazarus-ide.org/listinfo/lazarus

Reply via email to