foundry icon indicating copy to clipboard operation
foundry copied to clipboard

`forge fmt` can't handle `// forgefmt: disable-next-line` with a comment on the next line

Open duncancmt opened this issue 9 months ago • 0 comments

Component

Forge

Have you ensured that all of these are up to date?

  • [X] Foundry
  • [X] Foundryup

What version of Foundry are you on?

forge 0.2.0 (a117fbf 2024-05-13T00:18:52.080591906Z)

What command(s) is the bug in?

forge fmt

Operating System

Linux

Describe the bug

src/example.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.25;

contract Dummy {
    // forgefmt: disable-next-line
    function dummy() external returns (uint256) { // comment
        return 0;
    }
}
$ forge fmt
Error: 
Failed to construct valid Solidity code for src/example.sol. Leaving source unchanged.
Debug info: [Diagnostic { loc: File(0, 140, 147), level: Error, ty: ParserError, message: "unrecognised token 'uint256', expected \";\", \"case\", \"constant\", \"default\", \"external\", \"immutable\", \"internal\", \"leave\", \"override\", \"payable\", \"private\", \"public\", \"pure\", \"return\", \"returns\", \"revert\", \"switch\", \"view\", \"virtual\", \"{\", identifier", notes: [] }]

duncancmt avatar May 13 '24 18:05 duncancmt