solhint icon indicating copy to clipboard operation
solhint copied to clipboard

the "true" keyword is not accepted when used in assembly

Open PaulRBerg opened this issue 3 years ago • 0 comments

Take the following code snippet:

function isPowerOfTen(uint256 x) external view returns (bool result) {
    assembly {
        switch x
            case 1 {
                result := true
            }
            case 10 {
                result := true
            }
            case 100 {
                result := true
            }
            case 1000 {
                result := true
            }
            /// ...
    }
}

I am getting the following error in VSCode, although the code compiles just fine when I run hardhat compile.

Linter: Parse error: mismatched input 'true' expecting {'from', 'address', 'calldata', 'return', 'byte', 'callback', DecimalNumber, HexNumber, HexLiteralFragment, 'leave', 'payable', 'receive', Identifier, StringLiteralFragment} [undefined]

In the meantime I fixed this by replacing true with 1, so it's not a biggy, but I thought to report this anyways.

PaulRBerg avatar Mar 31 '21 07:03 PaulRBerg