aptos-core icon indicating copy to clipboard operation
aptos-core copied to clipboard

[Bug] Almost swapped lint does not detect swapping parameters

Open vineethk opened this issue 6 months ago • 1 comments

🐛 Bug

Consider the following code:

  public fun needs_almost_swapped_warning(x: u64, y: u64): (u64, u64) {
    x = y;
    y = x;
    (x, y)
  }

The almost swapped lint (https://aptos.dev/en/build/smart-contracts/linter#almost_swapped) is supposed to emit a warning on this code, but it currently does not.

vineethk avatar May 28 '25 15:05 vineethk

cc @JakeSilverman

This is likely because parameters in the model ASTs can be Temporary and not LocalVar.

vineethk avatar May 28 '25 15:05 vineethk

This issue is stale because it has been open 45 days with no activity. Remove the stale label or comment - otherwise this will be closed in 15 days.

github-actions[bot] avatar Jul 14 '25 02:07 github-actions[bot]