* ignore errors in setlength parsing inside a generic functin, resolves #20557

git-svn-id: trunk@19561 -
This commit is contained in:
florian 2011-10-30 19:22:55 +00:00
parent 2df900652e
commit 5d4607f65a
3 changed files with 46 additions and 8 deletions

1
.gitattributes vendored
View File

@ -11888,6 +11888,7 @@ tests/webtbs/tw20421.pp svneol=native#text/pascal
tests/webtbs/tw2045.pp svneol=native#text/plain
tests/webtbs/tw2046a.pp svneol=native#text/plain
tests/webtbs/tw20527.pp svneol=native#text/plain
tests/webtbs/tw20557.pp svneol=native#text/pascal
tests/webtbs/tw2059.pp svneol=native#text/plain
tests/webtbs/tw2065.pp svneol=native#text/plain
tests/webtbs/tw2069.pp svneol=native#text/plain

View File

@ -57,7 +57,7 @@ implementation
scanner,
pbase,pexpr,
{ codegen }
cgbase
cgbase,procinfo
;
@ -508,12 +508,22 @@ implementation
isarray:=is_dynamic_array(destppn.resultdef);
if not((destppn.resultdef.typ=stringdef) or
isarray) then
begin
CGMessage(type_e_mismatch);
paras.free;
exit;
end;
begin
{ possibly generic involved? }
if df_generic in current_procinfo.procdef.defoptions then
begin
result.free;
result:=internalstatements(newstatement);
paras.free;
exit;
end
else
begin
CGMessage(type_e_mismatch);
paras.free;
exit;
end;
end;
{ only dynamic arrays accept more dimensions }
if (dims>1) then
begin
@ -584,7 +594,7 @@ implementation
cordconstnode.create(getparaencoding(destppn.resultdef),u16inttype,true),
paras
)
);
);
end
else
begin

27
tests/webtbs/tw20557.pp Normal file
View File

@ -0,0 +1,27 @@
program generictest5;
{$mode delphi}{$H+}
type
TRec<T> = record
Value : T;
end;
TRecArray<T> = array of TRec<T>;
{ TFoo }
TFoo<T> = class
FArr : TRecArray<T>;
procedure Test;
end;
{ TFoo<T> }
procedure TFoo<T>.Test;
begin
SetLength(FArr, 1);
end;
begin
end.