Codecompletion fails on generic class in delphi mode
Original Reporter info from Mantis: markus_ja
-
Reporter name: Markus
Original Reporter info from Mantis: markus_ja
- Reporter name: Markus
Description:
There are actually 2 related issues:
- When you create a method by pressing Ctrl+Shift+C from the interface, the implemented method is not quite correct. There is the generic type missing, and it doesn't compile.
TGen<T> = class
public
constructor Create;
end;
Pressing Ctrl+Shilft+C creates:
constructor TGen.Create;
begin
end;
this is wrong. It should be (the generic type T is missing):
constructor TGen&LtPos;T>.Create;
begin
end;
- When the created method is corrected manually, and you press Ctrl+Shift+C in that class again. All methods are re-created in the implementation section. It seems code completion doesn't recognize the modified synstax
Steps to reproduce:
- Copy the following unit:
unit delphi_generics;
{$mode delphi}{$H+}
interface
uses
Classes, SysUtils;
type
{ TGen }
TGen<T> = class
public
constructor Create;
end;
implementation
end.
- Press Ctrl+Shift+C in the TGen&LtPos;T> class
ERROR: The following method is created:
constructor TGen.Create;
begin
end;
Should be TGen&LtPos;T>
-
Compile it:
ERROR: class identifier expected. -
Change it to:
constructor TGen<T>.Create;
begin
end;
-
Compile it:
Now it works!! -
Add a new function to the class: e.g.
function GetValue: T; -
Press Ctrl+Shilft+C in the class again.
ERROR: Create is re-created along with GetValue, with the missing type &LtPos;T> snytax.