The compiler is being a little lax because there is no ambiguity in doing so.
Consider the following:
program OpenArrays;
{$APPTYPE CONSOLE}
procedure Test1(i: Integer); overload;
begin
Writeln('Test1Integer');
end;
procedure Test1(i: array of Integer); overload;
begin
Writeln('Test1OpenArray');
end;
procedure Test2(i: array of Integer);
begin
Writeln('Test2');
end;
var
i: Integer;
begin
Test1(i);
Test1([i]);
Test2(i);
Readln;
end.
which produces this output:
Test1Integer Test1OpenArray Test2
I've overloaded Test1
so that there is a version that receives an integer, and a version that receives an open array of integers. In that situation, the call Test1(i)
goes to the overload that receives just an integer. On the other hand, I can call Test2
which receives an open array, just by passing an integer.
I believe that this behaviour is not documented in the language guide. However, @hvd found the following in the documentation for compiler error E2192 (emphasis mine):
Open array arguments must be supplied with an actual array variable, a constructed array or a single variable of the argument's element type.