This commit is contained in:
Ivan Bondarev 2023-11-01 18:24:35 +01:00
parent 28b1a4917b
commit acaff327bc
2 changed files with 16 additions and 6 deletions

10
TestSuite/delegates21.pas Normal file
View file

@ -0,0 +1,10 @@
procedure pr1(act: (array of integer)-> ());
begin
act(Arr(1,2,3));
end;
var l: integer;
begin
pr1(x-> begin l := x.Length end);
assert(l = 3);
end.

View file

@ -21055,14 +21055,14 @@ namespace PascalABCCompiler.TreeConverter
if (_modern_proc_type.el != null)
{
var en = _modern_proc_type.el;
if (en.enumerators.Count == 1)
AddError(get_location(en.enumerators[0].name), "ONE_TYPE_PARAMETER_MUSTBE_WITHOUT_PARENTHESES");
//if (en.enumerators.Count == 1)
// AddError(get_location(en.enumerators[0].name), "ONE_TYPE_PARAMETER_MUSTBE_WITHOUT_PARENTHESES");
for (int i = 0; i < en.enumerators.Count; i++)
{
if (en.enumerators[i].value != null)
AddError(get_location(en.enumerators[i].name), "ONE_TKIDENTIFIER");
if (!(en.enumerators[i].name is named_type_reference))
if (!(en.enumerators[i].name is named_type_reference) && !(en.enumerators[i].name is array_type))
AddError(get_location(en.enumerators[i].name), "ONE_TKIDENTIFIER");
t.Add(en.enumerators[i].name); // ???????????????
@ -21084,15 +21084,15 @@ namespace PascalABCCompiler.TreeConverter
if (_modern_proc_type.el != null)
{
var en = _modern_proc_type.el;
if (en.enumerators.Count == 1)
AddError(get_location(en.enumerators[0].name), "ONE_TYPE_PARAMETER_MUSTBE_WITHOUT_PARENTHESES");
//if (en.enumerators.Count == 1)
// AddError(get_location(en.enumerators[0].name), "ONE_TYPE_PARAMETER_MUSTBE_WITHOUT_PARENTHESES");
for (int i = 0; i < en.enumerators.Count; i++)
{
if (en.enumerators[i].value != null)
AddError(get_location(en.enumerators[i].name), "ONE_TKIDENTIFIER");
if (!(en.enumerators[i].name is named_type_reference))
if (!(en.enumerators[i].name is named_type_reference) && !(en.enumerators[i].name is array_type))
AddError(get_location(en.enumerators[i].name), "ONE_TKIDENTIFIER");
t.Add(en.enumerators[i].name);