mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2026-01-03 07:40:35 +01: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
28 lines
541 B
ObjectPascal
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. |