-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Labels
C-forgeCommand: forgeCommand: forgeCmd-forge-fmtCommand: forge fmtCommand: forge fmtT-bugType: bugType: bug
Description
Component
Forge
Have you ensured that all of these are up to date?
- Foundry
- Foundryup
What version of Foundry are you on?
forge 0.2.0 (9256265 2023-01-12T00:04:39.480435Z)
What command(s) is the bug in?
fmt
Operating System
macOS (Apple Silicon)
Describe the bug
When running forge fmt
on the following code, Forge will introduce two new tab-widths of spacing on the line(s) taken up by the function attributes (internal
, pure,
returns
, etc) every time the command is run, even when it means the resulting line(s) will exceed the max line length specified by settings. This is true regardless of default or custom [fmt]
settings.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
contract ReturnFnFormat {
function returnsFunction()
internal
pure
returns (
function()
internal pure returns (uint256)
)
{}
}
It also will not correctly put a space between returns
and the parentheses containing the type(s) returned by the returned function pointer, but will correctly add one to the function definition's returns
attribute.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
contract ReturnFnFormat {
function returnsFunction()
internal
pure
returns(
function()
internal pure returns(uint256)
)
{}
}
becomes
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
contract ReturnFnFormat {
function returnsFunction()
internal
pure
returns (
function()
internal pure returns(uint256)
)
{}
}
Metadata
Metadata
Assignees
Labels
C-forgeCommand: forgeCommand: forgeCmd-forge-fmtCommand: forge fmtCommand: forge fmtT-bugType: bugType: bug