* do not throw an internal error if slice is used on dyn. array paramters, resolves #39806

This commit is contained in:
florian 2022-06-23 23:10:48 +02:00
parent 2d8b10a5d8
commit 8eb2cea349
2 changed files with 21 additions and 1 deletions

View File

@ -4179,7 +4179,9 @@ implementation
end;
in_slice_x:
internalerror(2005101502);
{ slice can be used only in calls for open array parameters, so it has to be converted appropriatly before
if we get here, the array could not be passed to an open array parameter so it is an error }
CGMessagePos(left.fileinfo,type_e_mismatch);
in_ord_x,
in_chr_byte:

18
tests/webtbf/tw39806.pp Normal file
View File

@ -0,0 +1,18 @@
{ %fail }
program test;
type
TByteDynArr = array of byte;
procedure proc(a: TByteDynArr);
begin
Writeln(Length(a));
end;
var
x: array of byte;
begin
x:= [1,2,3,4];
proc(Slice(x, 2));
// <source>(15,19) Fatal: Internal error 2005101501
end.