ghkweon / dwscript

Automatically exported from code.google.com/p/dwscript
0 stars 0 forks source link

Overload resolution fails with mixed private/public methods #490

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
unit A;

interface
type
   TFoo = class
   private
      procedure Bar(value: integer); overload;
   public
      procedure Bar(value: string);  overload;
   end;

implementation

procedure TFoo.Bar(value: integer);
begin
end;

procedure TFoo.Bar(value: string);
begin
end;

end.

-------------------------------------------

program Test;
uses A;

begin
   var foo := TFoo.Create;
   foo.Bar('Hello!');
end.

-------------------------------------------

Expected: this should work.
Observed: Error, Bar (the wrong one!) is private.

Original issue reported on code.google.com by masonwhe...@gmail.com on 17 Sep 2014 at 3:04

GoogleCodeExporter commented 8 years ago
Good catch, never had considered that case.
The reverse bug was present as well (ie. gain access to a private method 
through an overload)

Fixed & added tests

Original comment by zar...@gmail.com on 18 Sep 2014 at 8:44

GoogleCodeExporter commented 8 years ago
This issue was closed by revision r2603.

Original comment by zar...@gmail.com on 18 Sep 2014 at 8:44