fpc/tests/test/timpfuncspez25.pp
Sven/Sarah Barth 90844c2027 * fix #35261: apply slightly adjusted changes by Ryan Joseph to implement support for implicit generic function specializations
The main adjustments were as follows:
  - fixing coding style and identation
  - fixing some typos
  - using a better name for the property in tcallcandidates which holds the symbols created for anonymous parameter values
2022-04-20 18:59:31 +02:00

41 lines
684 B
ObjectPascal

{%NORUN}
{$mode objfpc}
{$modeswitch implicitfunctionspecialization}
{
Test generic methods within generic method bodies
}
program timpfuncspez25;
type
TMyClass = class
generic procedure DoThis<T>(msg: T);
generic procedure DoThat<T>(msg: T);
end;
TMyChild = class(TMyClass)
generic procedure DoSomething<T>(msg: T);
end;
generic procedure TMyClass.DoThis<T>(msg:T);
begin
DoThat(msg);
end;
generic procedure TMyClass.DoThat<T>(msg: T);
begin
end;
generic procedure TMyChild.DoSomething<T>(msg: T);
begin
DoThis(msg);
end;
var
a: TMyClass;
b: TMyChild;
begin
a := TMyClass.Create;
a.DoThis(1);
b := TMyChild.create;
b.DoSomething(1);
end.