Some of these bugs are really weird, because sometimes lazarus thinks the function was not defined, and produces a new function of an already defined function which of course leads to compilation errors
I had this error and it sometimes is due to a "silly" difference between interface and implementation. If you define
function MyFunction: Boolean;
but you implement it like this:
function TMyClass.MyFunction(): Boolean;
begin
end;
The extra parenthesis on implementation (or in the interface) causes the problem. There are other cases which i didn't pay attention to the cause and could have happened for a different reason.
ETA:
Other case is when you have a property declared like this:
TMyClass = Class(TObject)
private
FMyData: Integer;
public
procedure SetMyData(const SomeValue: Integer);
property MyData: Integer read FMyData write SetMyaData;
end;
On this case if you add a new method or property to the class and then press Ctrl+J youwill have a new SetMyData on the private section.
I, personally would prefer if functions, procedures and methods without parameters where forced to have parenthesis not for what I described above but because it confused the compiler with some procedural types. Example:
type
TProc1 = procedure of object;
TProc2 = procedure () of object;
var
Proc1: TProc1;
Proc2: TProc2
{....}
if Assigned(Proc2) then
Proc2();
if Assigned(Proc1) then
Proc1; //< Error ":=" expected but ";" found
It also makes more visible when something is a property and when is a method.