mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-07 20:28:24 +02:00

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
26 lines
523 B
ObjectPascal
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. |