I have following code (simplified):
program Project1;
{$APPTYPE CONSOLE}
uses
SysUtils,
Unit1 in 'Unit1.pas';
var
f: TFoo<Integer>;
begin
f := TFoo<Integer>.Create;
f.Baz;
Readln;
end.
unit Unit1;
{$D-}
interface
type
TFoo = class
public
procedure Bar(const s: string);
end;
TFoo<T> = class(TFoo)
public
procedure Baz;
end;
implementation
uses
TypInfo;
{ TFoo }
procedure TFoo.Bar(const s: string);
begin
Writeln(s);
end;
{ TFoo<T> }
procedure TFoo<T>.Baz;
begin
Bar(PTypeInfo(TypeInfo(T)).Name);
end;
end.
Now when stepping into f.Baz
I always end up in Unit1.TFoo<T>.Baz
although I explicitly disabled debug info for that unit but I cannot step into TFoo.Bar
which is correct. I think this is because of how generics internally are implemented (like templates) and because TFoo<Integer>
is defined in my Project1
. When I add following unit I cannot step into Baz
anymore:
unit Unit2;
{$D-}
interface
uses
Unit1;
type
TIntegerFoo = TFoo<Integer>;
implementation
end.
Now is there any way to remove debug info for a generic type altogether so I can specialize that type anywhere (where debug info is on) but avoid stepping into the methods of the generic type? I guess it must be possible since I cannot step info any Generics.Collections.TList<T>
method without enabling the "use debug .dcus" option.