mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-07 17:47:56 +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
27 lines
517 B
ObjectPascal
27 lines
517 B
ObjectPascal
{$mode objfpc}
|
|
{$modeswitch implicitfunctionspecialization}
|
|
{
|
|
Test specialized arrays and array constructors
|
|
}
|
|
|
|
program timpfuncspez12;
|
|
uses
|
|
typinfo;
|
|
|
|
type
|
|
generic TMyArray<T> = array of T;
|
|
|
|
generic function DoThis<T>(a: specialize TMyArray<T>): TTypeKind;
|
|
begin
|
|
writeln(GetTypeKind(T), ': ', Length(a));
|
|
result := GetTypeKind(T);
|
|
end;
|
|
|
|
begin
|
|
if DoThis(['a','b','c']) <> tkChar then
|
|
Halt(-1);
|
|
if DoThis(['aaa','bbb','ccc']) <> tkString then
|
|
Halt(-1);
|
|
if DoThis([1,2,3]) <> tkInteger then
|
|
Halt(-1);
|
|
end. |