[fpc-devel] Bug? "overload" between class.method and plain procedure ?
lazarus at mfriebe.de
Sat Dec 11 11:30:11 CET 2021
Should overload work for the following?
Upon seeing the method being overloaded, if (in the class hierarchy) no
method with matching signature is found, should procedures outside the
class be searched?
> project1.lpr(19,8) Error: Incompatible type for arg no. 1: Got
"ShortInt", expected "Boolean"
In the below example, I could write "project1.Foo(1); ". But if I had
various "Foo" in various included units, then it would be inconvenient
to always have to find the correct unit myself.
The doc https://www.freepascal.org/docs-html/ref/refsu86.html does not
contain any references to classes. It only refers to cross unit.
procedure Foo(a: integer); forward; overload;
TBar = class
procedure Foo(a: boolean); overload;
procedure TBar.Foo(a: boolean);
Foo(1); //project1.lpr(19,8) Error: Incompatible type for arg no. 1:
Got "ShortInt", expected "Boolean"
procedure Foo(a: integer);
More information about the fpc-devel