prettier-plugin-solidity
prettier-plugin-solidity copied to clipboard
Error on multiple return values in assembly
contract C {
function foo() public {
assembly {
function bar() -> x, y { }
let x
let y
x, y := bar()
}
}
}
results in
$ prettier --check "contracts/**/*.sol"
contracts/contract.sol
[error] contracts/contract.sol: Error: extraneous input ',' expecting {'from', '{', '}', '(', 'error', 'for', 'function', 'address', 'calldata', 'if', 'assembly', 'return', 'revert', 'byte', 'let', '=:', 'switch', 'callback', DecimalNumber, HexNumber, HexLiteralFragment, 'break', 'continue', 'leave', 'payable', 'constructor', 'receive', Identifier, StringLiteralFragment} (11:13)
[error] at Object.parse (/node_modules/prettier-plugin-solidity/node_modules/@solidity-parser/parser/dist/index.cjs.js:36867:11)
[error] at Object.parse (/node_modules/prettier-plugin-solidity/src/parser.js:18:25)
[error] at Object.parse$a [as parse] (/node_modules/prettier/index.js:12513:19)
[error] at coreFormat (/node_modules/prettier/index.js:14044:16)
[error] at formatWithCursor$1 (/node_modules/prettier/index.js:14284:14)
[error] at Object.formatWithCursor (/node_modules/prettier/index.js:59304:12)
[error] at format$1 (/node_modules/prettier/bin-prettier.js:16953:21)
[error] at Object.formatFiles$1 [as formatFiles] (/node_modules/prettier/bin-prettier.js:17067:16)
[error] at async main (/node_modules/prettier/bin-prettier.js:18925:5)
[error] at async Object.run (/node_modules/prettier/bin-prettier.js:18868:5)
Also trying to wrap the respective lines with an ignore has no effect.
contract C {
function foo() public {
assembly {
function bar() -> x, y { }
let x
let y
// prettier-ignore
{
x, y := bar()
}
}
}
}
https://github.com/solidity-parser/antlr/pull/11 will fix the problem.