fpc/tests/test/timpfuncspez14.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

25 lines
479 B
ObjectPascal

{%NORUN}
{$mode objfpc}
{$modeswitch implicitfunctionspecialization}
{
Test specializing proc vars by infering parameters from callback function
}
program timpfuncspez14;
type
generic TProc<S> = procedure(name: S; value: integer);
generic procedure Run<T, U>(proc: specialize TProc<T>; context: U);
begin
proc('TProc', context);
end;
procedure DoCallback(name: string; value: integer);
begin
writeln(name, ' called ', value);
end;
begin
Run(@DoCallback, 100);
end.