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

34 lines
604 B
ObjectPascal

{$mode objfpc}
{$modeswitch implicitfunctionspecialization}
{
Test open arrays and array constructors
}
program timpfuncspez32;
uses
typinfo;
generic function DoThis<T>(a: array of T): TTypeKind;
begin
writeln(GetTypeKind(T), ': ', Length(a));
result := GetTypeKind(T);
end;
type
TIntArray = array of integer;
var
s1: array of integer;
s2: array[0..2] of integer;
begin
s1 := [1,2,3];
if DoThis(s1) <> tkInteger then
Halt(-1);
s2 := [1,2,3];
if DoThis(s2) <> tkInteger then
Halt(-1);
s1 := TIntArray.Create(1,2,3);
if DoThis(s1) <> tkInteger then
Halt(-1);
end.