Export to GitHub

dwscript - issue #490

Overload resolution fails with mixed private/public methods


Posted on Sep 17, 2014 by Swift Camel

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.

Comment #1

Posted on Sep 18, 2014 by Happy Rabbit

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

Comment #2

Posted on Sep 18, 2014 by Happy Rabbit

This issue was closed by revision r2603.

Status: Fixed

Labels:
Type-Defect Priority-Medium