-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: parse selector hashes in
sol
macro (#730)
* fix: parse selectors in sol macro * run fmt * add clippy lint suggestoins * code formatting * more formatting * feat: include namespaces, add tests * chore: use [u8; 4] --------- Co-authored-by: DaniPopes <57450786+DaniPopes@users.noreply.github.com>
- Loading branch information
Showing
6 changed files
with
213 additions
and
368 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
use alloy_sol_types::sol; | ||
|
||
// https://github.com/alloy-rs/core/issues/729 | ||
|
||
sol! { | ||
error func_2093253501(bytes); | ||
error transfer(address,uint256); | ||
|
||
function func_2093253501(bytes); | ||
function transfer(address,uint256); | ||
|
||
error BlazingIt4490597615(); | ||
|
||
contract A { | ||
error func_2093253501(bytes); | ||
error transfer(address,uint256); | ||
|
||
function func_2093253501(bytes); | ||
function transfer(address,uint256); | ||
|
||
error BlazingIt4490597615(); | ||
} | ||
} | ||
|
||
// This is OK. | ||
mod namespaced { | ||
use alloy_sol_types::sol; | ||
|
||
sol! { | ||
function func_2093253501(bytes); | ||
|
||
contract B { | ||
function transfer(address,uint256); | ||
} | ||
} | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
error: function selector `0xa9059cbb` collides with `func_2093253501` | ||
--> tests/ui/collisions.rs:10:14 | ||
| | ||
10 | function transfer(address,uint256); | ||
| ^^^^^^^^ | ||
| | ||
note: other declaration is here | ||
--> tests/ui/collisions.rs:9:14 | ||
| | ||
9 | function func_2093253501(bytes); | ||
| ^^^^^^^^^^^^^^^ | ||
|
||
error: error selector `0x00000000` is reserved | ||
--> tests/ui/collisions.rs:12:11 | ||
| | ||
12 | error BlazingIt4490597615(); | ||
| ^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: function selector `0xa9059cbb` collides with `func_2093253501` | ||
--> tests/ui/collisions.rs:19:18 | ||
| | ||
19 | function transfer(address,uint256); | ||
| ^^^^^^^^ | ||
| | ||
note: other declaration is here | ||
--> tests/ui/collisions.rs:18:18 | ||
| | ||
18 | function func_2093253501(bytes); | ||
| ^^^^^^^^^^^^^^^ | ||
|
||
error: error selector `0x00000000` is reserved | ||
--> tests/ui/collisions.rs:21:15 | ||
| | ||
21 | error BlazingIt4490597615(); | ||
| ^^^^^^^^^^^^^^^^^^^ |
Oops, something went wrong.