[fpc-devel] Type+multi helpers overload bug
Hairy Pixels
genericptr at gmail.com
Sun May 8 06:26:07 CEST 2022
Basically it looks like multi helpers don’t actually work with overloaded methods and simply choses the last helper declared. Should I fix this? Seems unlikely we would not notice this before but maybe we did.
{$modeswitch typehelpers}
{$modeswitch multihelpers}
type
TMyHelper1 = type helper for integer
procedure DoThis(f: integer);
end;
TMyHelper2 = type helper for integer
procedure DoThis(f: string);
end;
procedure TMyHelper1.DoThis(f: integer);
begin
writeln(self, ' => ', f);
end;
procedure TMyHelper2.DoThis(f: string);
begin
writeln(self, ' => ', f);
end;
var
i: integer = 0;
begin
i.DoThis(0); // Got "ShortInt", expected “ShortString"
Regards,
Ryan Joseph
More information about the fpc-devel
mailing list