In a unit I use the function DeleteFile and the compiler outputs a hint:
\"H2443 Inline function \'DeleteFile\' has not been expanded because
I was also confused by this hint. Then i realized what the issue is. Your code:
uses
SysUtils;
procedure TForm1.DoStuff;
begin
SysUtils.DeleteFile('foo');
end;
is literally being replaced with:
uses
SysUtils;
procedure TForm1.DoStuff;
var
Flags, LastError: Cardinal;
begin
Result := Winapi.Windows.DeleteFile(PChar(FileName));
if not Result then
begin
LastError := GetLastError;
Flags := GetFileAttributes(PChar(FileName));
if (Flags <> INVALID_FILE_ATTRIBUTES) and (faSymLink and Flags <> 0) and
(faDirectory and Flags <> 0) then
begin
Result := RemoveDirectory(PChar(FileName));
Exit;
end;
SetLastError(LastError);
end;
end;
If you'll notice, your "new" code depends on WinApi.Windows unit:
Result := Winapi.Windows.DeleteFile(PChar(FileName));
which you didn't include in your uses clause.
If you manually had inlined the code (copied and pasted), the code would simply not compile until you added Windows to your uses.
Instead, the compiler will not do the inline because:
Inline function 'DeleteFile' has not been expanded because unit 'Windows' is not specified in USES list"