Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/IDE/Class Completion    [ Add a report in this area ]  
Report #:  88011   Status: Open
Class Completion creates duplicate methods
Project:  Delphi Build #:  15.0.3890.34076
Version:    15.0 Submitted By:   Thomas Mueller
Report Type:  Suggestion / Enhancement Request Date Reported:  9/13/2010 5:42:07 AM
Severity:    Infrequently encountered problem Last Updated: 3/20/2012 2:24:39 AM
Platform:    All versions Internal Tracking #:   280407
Resolution: None (Resolution Comments) Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: 5
Description
If a method declaration like this

procedure a(b: dword);

with an implementation like this:

procedure TMyClass.a(b: cardinal);
begin
end;

exists, class completion works as expected: It does nothing.

But if you add an overload directive to the declaration and press Shift+Ctrl+c, class completion creates an additional declaration with b: cardinal and an implementation with b: dword.
Steps to Reproduce:
Create a unit with this code:

unit Unit1;

interface

uses
  Windows;

type
  tmyclass = class
  private
    procedure a(b: dword); overload;
  end;

implementation

procedure tmyclass.a(b: Cardinal);
begin
end;

end.

This code is correct and compiles because DWord=Cardinal.

Now press Shift+Ctrl+c. The IDE will add one new declaration and one new implementation like this:

unit Unit1;

interface

uses
  Windows;

type
  tmyclass = class
  private
    procedure a(b: dword); overload;
    procedure a(b: Cardinal);
  end;

implementation

procedure tmyclass.a(b: Cardinal);
begin
end;

procedure tmyclass.a(b: dword);
begin
end;

end.

This code does not compile because it contains two erros:
1. The second declaration does not have the overload directive
2. Since dword = cardinal the overload is not allowed.
Workarounds
None
Attachment
None
Comments

None

Server Response from: ETNACODE01