Skip to content

Conversation

grandizzy
Copy link
Contributor

ref foundry-rs/foundry#11417
for

// SPDX-License-Identifier: MIT
pragma solidity >=0.8.19;
...

function convert(UD60x18 x) pure returns (uint256 result) {
...
}

function convert(uint256 x) pure returns (UD60x18 result) {
...
}

we have items as

[
  (8378, ItemLocation { path: "lib/prb-math/src/ud60x18/Conversions.sol", start: 462, end: 469 }), 
  (8409, ItemLocation { path: "lib/prb-math/src/ud60x18/Conversions.sol", start: 833, end: 840 })
]

but we sort only by path, hence order could be reversed.

Sort also by loc.start to make sure order is preserved

@grandizzy grandizzy marked this pull request as ready for review August 25, 2025 18:24
@grandizzy grandizzy changed the title fix(flatten): sort by loc path and start fix(flatten): sort by loc path and loc start Aug 25, 2025
Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, makes sense

@mattsse mattsse merged commit a4cec2c into foundry-rs:main Aug 25, 2025
15 checks passed
@grandizzy grandizzy deleted the deterministic-flattened-fns branch August 25, 2025 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants