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.

Hello,

Also it seems that at least in our production coe there are false positives if value comes from TStrings

Something like
LString := Format('%s', [LStringList[0]]);

Hello Folks,
I also want to add another false positive detection of the W537 oddity, that happens when using the string overload of the IfThen() function.

For example these patterns cause a false positive detection:

Format('Ack %sreceived', [IfThen(Result < 0, 'not ')])

Format(
  'SearchEmptySlot: Found %s suitable place for current pack.',
  [IfThen(bPlaceOnShelfFound, 'a', 'no')])

Note: this was encountered with the latest available v2023.12