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

28 lines
541 B
ObjectPascal

{%NORUN}
{$mode objfpc}
{$modeswitch implicitfunctionspecialization}
{
Test specializing related object types
DoThis<T> can be specialized as DoThis<Integer>
because TSomeRecord is specialized from TAnyRecord<Integer>
and therefore we can infer "Integer" as the correct parameter
}
program timpfuncspez20;
type
generic TAnyRecord<U> = record
end;
type
TSomeRecord = specialize TAnyRecord<Integer>;
generic procedure DoThis<T>(aRecord: specialize TAnyRecord<T>);
begin
end;
var
rec: TSomeRecord;
begin
DoThis(rec);
end.