Compile error in .82

Start with a DA template project, add a property in the DataAccess class like this:

property aTable: DADataTable public read private write;

Then add a file with this:

namespace test;

interface

uses
  Foundation, DataAbstract;

type
  testDetail = public class
  private
  protected
  public
    
    method aTable:NSArray;
  end;
type
  testMaster = public class
  private
  protected
  public
    
    property someDetails:NSMutableArray;
    method detailsQty:Integer;
  end;
implementation

method testMaster.detailsQty:Integer;
begin
  result:=0;
  for each testDetail in someDetails do result:=result+testDetail:aTable:count;
end;

method testDetail.aTable:NSArray;
begin
  var aindex:='something';
  result:= DataAccess.sharedInstance.aTable.rowsFilteredUsingPredicate(NSPredicate.predicateWithFormat('aindex= %@',aindex));
end;

end.

It won’t compile with “error E44: No member “count” on type “DADataTable”” in the detailsQty method.

If you rename ‘aTable’ to something else then it is fine, the problem is only if the same name is used in this class as in the DataAccess class.

This works fine in .81

Thanks, logged as bugs://72620

I had a look, there’s a problem here:

for each testDetail in someDetails do 

testDetail is now an ID type, since someDetail is an NSMutableArray without generic parameter. So at this poitn it has to guess, it prefers a property to a method so ends up using a property. The best fix would be to use a type:

for each testDetail: testDetail in someDetails do

bugs://72620 got closed with status nochangereq.

I’ll see if i can strongly-type the RemObjects SDK/Data Abstract arrays, for v9.

Though, never mind,this wont help here since it’s your own local array var, of course :wink: