assigning new created array to array with 2 dimension

Issue #212 resolved
Former user created an issue

for array with 1 dimension all is ok, otherwise error. Error msg: (25:14): Incompatible types: Cannot assign "array [0..3] of ByteTyp" to "array of Integer"

Code for reproduce error attached.

program test1;

type ByteTyp = Integer;

var 
  arr : array of integer;
  arr2Dim : array of array of integer;

function GetByteType : ByteTyp;
begin
  Result := 99;
end;

begin
//thats ok
    arr.SetLength(4);   
    arr := [GetByteType(), $13BE, $0487, 567];   
    AddToSystemJournal (arr[0]);       //AddToSystemJournal = symlink to WriteLn

//but that - no!
  arr2Dim.SetLength(2);

  for var i := 0 to Length(arr2Dim) - 1 do
    arr2Dim[i].SetLength(3);

  arr2Dim[0] := [GetByteType(), $13BE, $0487, 567];   
  AddToSystemJournal (arr2Dim[0,3]);   //AddToSystemJournal = symlink to WriteLn
end.  

Comments (3)

  1. Eric Grange repo owner

    Note: passes if declaration changed to

    var arr2DimB : array of array of ByteTyp;
    

  2. Log in to comment