Hi
I had this code working in older public release, but now I get warning “Local variable “fname” is assigned to but never read”. Is this correct? I use e.g. .NET console app with Delphi compatibility and legacy with clause support :
namespace ConsoleApplication3;
type
TC = class
private
fname : String ;
public
property FieldName : String read fname write fname;
end;
Program = class
public
class method Main(args: array of String): Int32;
begin
var c := new TC();
var fname := 'x'; // <- here
with c do begin
if fname <> FieldName then
FieldName := fname ;
end ;
end;
end;
end.
fname is a local variable but inside with clause, it becomes a class variable. The key here is using the same variable name. Is this a bug or correct code in the latest public release?