Codetools: Improve match of parameter array of record. (Earlier xxx commit belongs to this). Issue #39494, patch by Włodzimierz Bień.

This commit is contained in:
Juha 2026-02-18 10:44:58 +02:00
parent aa15430072
commit 13ccaf0c22
2 changed files with 37 additions and 1 deletions

View File

@ -13516,7 +13516,6 @@ begin
TargetParams:= TFindDeclarationParams.Create(Params);
TargetParams.SetIdentifier(Self,nil,nil);
TargetParams.Flags:=fdfDefaultForExpressions;
ExprOfElement:=CleanExpressionType;
ExprOfElement:=
FindExpressionTypeOfTerm(TargetNode.FirstChild.StartPos,-1,Params,false);
if ExprOfElement.Desc=xtContext then

View File

@ -0,0 +1,37 @@
unit test_param_array_of_record;
{$mode ObjFPC}{$H+}
interface
type
T = record
a: byte;
end;
implementation
function x(a: byte): T;
begin
result.a:=a;
end;
procedure Foo(s: integer); overload;
begin
end;
procedure Foo(s: integer; const b: array of T); overload;
begin
end;
procedure Foo(s: string; c: byte; const b: array of T); overload;
begin
end;
begin
Foo(1);
Foo{findrefs:11,23;3,34}(1, [x(1), x(2)]);
Foo{findrefs:11,27;3,35}('abc', 1, [x(1), x(2)]);
end.