construct POSIX file with variables I can construct a file with variables:
set filePath to &quot;Macintosh HD:tmp:test.txt&quot;
tell application &quot;Finder&quot;
    delete file filePath
end tell

However, same thing doesn’t work for POSIX file:
set filePath to &quot;/tmp/test.txt&quot;
tell application &quot;Finder&quot;
    delete POSIX file filePath
end tell

It says “can’t get POSIX file &quot;/tmp/test.txt&quot;” (-1728). The syntax looks correct, because it works when I use string literal instead of variable:
tell application &quot;Finder&quot;
    delete POSIX file &quot;/tmp/test.txt&quot;
end tell

I’m running scripts with osascript foobar.applescript in case that matters.
This AppleScript code works for me using the latest version of macOS Big Sur.
set filePath to &quot;/tmp/test.txt&quot;
tell application &quot;Finder&quot;
    delete filePath as POSIX file
end tell

This also works for me…
set filePath to POSIX file &quot;/tmp/test.txt&quot;
tell application &quot;Finder&quot;
    delete filePath
end tell