huff-rs icon indicating copy to clipboard operation
huff-rs copied to clipboard

Compiler incorrectly interprets parameter names

Open Philogy opened this issue 3 years ago • 0 comments

Expected behavior

1.1 Naming parameters as native solidity datatypes should lead to an error 1.2 A lack of a comma in a function definition should not lead to following datatypes affecting the function signature 2. You should be allowed to give a parameter a name that starts with "int" / "uint" / "bytes" 3. You should be able to name dynamic parameters (string, bytes, <type>[], etc.)

Currently observed behavior

Version: 0.3.0 (Note issues also observed under 0.2.0)

1.1 #define function balanceOf(address uint256) view returns (uint256 balance) => no error 1.2 #define function balanceOf(address uint256) view returns (uint256 balance) //; ... __FUNC_SIG(balanceOf) => returns signature for "balanceOf(address,uint256)" 2. #define function supportsInterface(bytes4 interfaceId) view returns (bool) => produces compiler error:

⠋ Compiling...thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ParseIntError { kind: InvalidDigit }', huff_utils/src/types.rs:47:49
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[1]    122499 IOT instruction (core dumped)  huffc src/ERC721H.huff -b
  1. #define function transferMany(uint256[] memory tokens) view returns () => produces compiler error:
⠙ Compiling...

Error: Invalid Argument Type: "tokens"
-> src/ERC721H.huff:858-864
       |
  > 16 | #define function transferMany(uint256[] memory tokens) view returns ()
       |

Philogy avatar Aug 05 '22 21:08 Philogy