I've hit a subtle issue whilst using the With ... Do construct in a program I am working on. I have isolated the behaviour to the following trivial unit:
Unit TestClasses;
Interface
Type
TOtherClass = Class
Public
SomeValue: Boolean;
End;
TMainClass = Class
Public
FOtherClass: TOtherClass;
Procedure DoSomething;
End;
Implementation
Procedure TMainClass.DoSomething;
Var
Test: Boolean;
Begin
// This compiles ok:
Test := FOtherClass.SomeValue;
// This Fails to compile:
With FOtherClass Do;
Test := SomeValue;
End;
End.The compilation halts with:
TestClasses.pas(27,22) Error: Identifier not found "SomeValue"I am working off Lazarus SVN with FPC 2.2.1 on Windows and 2.2.0 on Linux. The problem occurs in both environments, the version stamps are: v0.9.25 r14253 i386-win32-win32/win64
v0.9.25 r14253M i386-linux-gtk 2 (beta)
Is this a compiler bug or am I missing something?
Thanks,
Paul
