Fixinsight 2021.10 returns a wrong W537 when the format parameter is a resource string.

Example code to reproduce:

const
  cMessage = 'Hallo';
resourcestring
  cResource = 'Halli';

procedure PrintMessage;
begin
  WriteLn(Format('%s', [cMessage]));
  WriteLn(Format('%s', [cResource])); <-- Wrong W537 here
end;

And another one:

procedure PrintStringArray;
const
  cArray: array [0 .. 1] of string = ('Halli', 'Hallo');
var
  i  : integer;
  str: TArray<string>;
  sl : TStringList;
begin
  for i := 0 to High(cArray) do
    WriteLn(Format('%s', [cArray[i]]));

  sl := TStringList.Create;
  for i := 0 to sl.count - 1 do
    WriteLn(Format('%s', [sl[i]])); // <-- Wrong W537

  for i := 0 to High(str) do
    WriteLn(Format('%s', [str[i]]));

  sl := TStringList.Create;
  for i := 0 to sl.count - 1 do
    WriteLn(Format('%s', [sl[i]])); // <-- This passes. Same code as above. Why?
end;

FixInsight has undefined behaviour. Depending on whether there is code below the // <-- This passes comment, a W537 warning is raised (or not)

FixInsight has some undefined behaviour.

This code throws four W537 warnings in one of my units:

function PrintRect(const ARect: TRect): string;
begin
  result := Format('%d;%d;%d;%d', [ARect.Left, ARect.Top, ARect.Right, ARect.Bottom]);
end;

But when I move it into the sample project in which I collect the W537 errors listed above, it passes.

Hi @Onken_L
Thank you, this will be fixed in the next update.

Thank you Roman,

we turned off W537 on the build server, because it not only produces a lot of false positives, these false positives are also unreliable, meaning that one build they show up, the next they are gone on an identical unit.