Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2013-11

not possible add into class helper overloaded variant of some virtual method

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

ko paka

Hello,

in actual trunk - fpc 2.7.1 - is not possible to do folloving:

unit uStringListHelper;
{$mode delphiunicode}
interface
uses
  Classes, SysUtils;
type
  { TStringListHelper }
  TStringListHelper = class helper for TStringList
  public
    procedure LoadFromFile(const FileName: string; Encoding: TEncoding);
overload;
  end;
implementation

{ TStringListHelper }

procedure TStringListHelper.LoadFromFile(const FileName: string;
  Encoding: TEncoding);
begin
end;
end.
program testoverloadinclasshelper;
{$mode delphiunicode}
uses
  Classes, SysUtils, uStringListHelper;
var
  m: TStringList;
begin
  m := TStringList.Create;
  m.LoadFromFile('somefile.txt', TEncoding.UTF8);
end.

When I try to compile it, error "Wrong number of parameters ...." will be shown. Based on documentation I found (
http://www.freepascal.org/docs-html/ref/refse50.html) it should be possible. Is it a bug or am I missed something ?

One point more - when I had defined class helper type in same unit as main program (so not in separate unit uStringListHelper), compiler behavior was like there is no class helper defined. Is this correct as well ?

regards
tomas

Sven Barth
to ko paka
ko paka wrote
Hello, in actual trunk - fpc 2.7.1 - is not possible to do folloving:

[snip]

Show quoted text 10 lines
When I try to compile it, error "Wrong number of parameters ...." will be shown. Based on documentation I found (http://www.freepascal.org/docs-html/ref/refse50.html) it should be possible. Is it a bug or am I missed something ? One point more - when I had defined class helper type in same unit as main program (so not in separate unit uStringListHelper), compiler behavior was like there is no class helper defined. Is this correct as well ?

Both cases should work. Please report a bug.

Regards,
Sven