Bug: The "deprecated" warning specifies an incorrect position in the file
Based on issue freepascal.org/lazarus/lazarus#34591 (closed).
Summary
The deprecated function warning specifies an incorrect position in the file.
System Information
- Operating system: Windows 7
- Processor architecture: x86
- Compiler version: 3.2.2 (stable)
Steps to reproduce
Example 1
In this example, the warning correctly points to the word pp
:
program Project1;
{$mode objfpc}
type
tt = class
ff: boolean;
property pp: boolean read ff; deprecated;
end;
var
oo: tt;
begin
oo := tt.create;
if oo.pp then // warning indicates the word "pp"
;
end.
but if you use a with
statement, it will point to then
:
program Project1;
{$mode objfpc}
type
tt = class
ff: boolean;
property pp: boolean read ff; deprecated;
end;
var
oo: tt;
begin
oo := tt.create;
with oo do
if pp then // warning indicates the word "then"!
;
end.
Example 2
In this program, the warning shows the correct position:
program Project1;
{$mode objfpc}
type
tt = class
ff: boolean;
property pp: boolean read ff; deprecated;
procedure test;
end;
procedure tt.test;
begin
if self.pp then // warning indicates the word "pp"
;
end;
begin
end.
but if you remove self.
, it will point to then
:
program Project1;
{$mode objfpc}
type
tt = class
ff: boolean;
property pp: boolean read ff; deprecated;
procedure test;
end;
procedure tt.test;
begin
if pp then // warning indicates the word "then"!
;
end;
begin
end.