Since upgrading to Lazarus 0.9.24 which uses FPC 2.2.0, there seems to be a change in behaviour which is not listed in
http://www.freepascal.org/mantis/changelog_page.php.
If a Local Function is declared within a Method of a Class and it has the same name as another Method of the Class, the syntax error 'Duplicate Identifier "<name>" is flagged.
In the example below, the Procedure Display is declared local to GoButtonClick, but is flagged with the syntax error 'Duplicate Identifier "Display" because the Class contains a method called Display, even though they are in different scopes.
Is this an intended change to the Compiler ?
unit TestXPMain;
{$mode Delphi}{$H+}
interfaceuses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, ExtCtrls,
StdCtrls, Buttons;type
{ TForm1 }
TForm1 = class(TForm)
BottomPanel: TPanel;
GoButton: TButton;
Memo: TMemo;
TopPanel: TPanel;
procedure GoButtonClick(Sender: TObject);
private
{ private declarations }
public
PROCEDURE Display(Const Text : String);
end;
var
Form1: TForm1;
implementation{ TForm1 }
procedure TForm1.GoButtonClick(Sender: TObject);
PROCEDURE Display(Const Text : string);
begin
End;
begin
Display('Start');
end;
procedure TForm1.Display(const Text: String);
begin
Memo.Lines.Add(Text);
end;
initialization
{$I TestXPMain.lrs}
end.