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

26 lines
523 B
ObjectPascal

{%NORUN}
{$mode objfpc}
{$modeswitch implicitfunctionspecialization}
{
Test specializing related object types
DoThis<T> can be specialized as DoThis<Integer>
because TSomeClass is specialized from TAnyClass<Integer>
and therefore we can infer "Integer" as the correct parameter
}
program timpfuncspez19;
type
generic TAnyClass<U> = class
end;
type
TSomeClass = specialize TAnyClass<Integer>;
generic procedure DoThis<T>(aClass: specialize TAnyClass<T>);
begin
end;
begin
DoThis(TSomeClass.Create);
end.