Problem with Interfaces

Latest Fire Beta, platform Cocoa MacOS

I think something in the Compiler is broken with Interfaces.

i have done some tests with actual classes
the test looks like:

method test;
begin
    writeLn('Create as Class');
    var iMaster : IDBcwDatabase_ := new TcwFDDatabase_;
      
        var ctemp : TcwFDStatement_ :=  new TcwFDStatement_(iMaster);
        ctemp := nil;
        writeLn ('Finalizer is called');
        writeLn;
       
        writeLn('Create as Interface from Class with constructor');
        var temp : IDBcwStatement_ := new TcwFDStatement_(iMaster);
        temp := nil;
        writeLn ('Finalizer is called');
        writeLn;
        
        writeLn('Create as Interface from Method');
        var imtemp : IDBcwStatement_ := iMaster.GetCwQuery;
        imtemp := nil;
        writeLn ('Finalizer is not called!!!!');
    end;

// Output on Console

~> Process test started.
Create as Class
Statement finalize
Finalizer is called

Create as Interface from Class with constructor
Statement finalize
Finalizer is called

Create as Interface from Method
Finalizer is not called!!!
~> Process test terminated with exit code 0

The test Classes:

interface
type  
  IDBcwStatement_ = public interface
    method execute;
  end;
  IDBcwDatabase_ = public interface
    method GetCwQuery: IDBcwStatement_;
  end;

  TcwFDDatabase_ = public class(IDBcwDatabase_)
  public
    method GetCwQuery: IDBcwStatement_;
  end;

  TcwFDStatement_ = public class(IDBcwStatement_)
    constructor(adb : IDBcwDatabase_);
    finalizer;
    method execute;
  end;

implementation

method TcwFDDatabase_.GetCwQuery: IDBcwStatement_;
begin
  result := new TcwFDStatement_(self as IDBcwDatabase_) as IDBcwStatement_;
end;

constructor TcwFDStatement_(adb: IDBcwDatabase_);
begin
end;

finalizer TcwFDStatement_;
begin
  writeLn('Statement finalize');
end;

method TcwFDStatement_.execute;
begin
end;
end.

Seems I missed this post, sorry about that.

This is an unfortunate side effect of how the Objc abi works; methods calls are required to put result values in the ARP. In release mode we optimize away this ARP call, but in debug mode you have to explicit use

using autoreleasepool do begin
end;

to force it to be freed.