-
Notifications
You must be signed in to change notification settings - Fork 155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(sol-macro): bug fixes #372
Conversation
@@ -314,7 +314,7 @@ impl<'a> CallLikeExpander<'a> { | |||
.map(Self::#variants) | |||
})* | |||
s => ::core::result::Result::Err(::alloy_sol_types::Error::unknown_selector( | |||
Self::NAME, | |||
<Self as ::alloy_sol_types::SolInterface>::NAME, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Part of issue #361
expected reference &'static str found enum constructor
this triggered because Self::NAME
resolved first as the variant vs the trait constant
const RESOLVE_LIMIT: usize = 8; | ||
const RESOLVE_LIMIT: usize = 32; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pub fn expand(ast: File) -> Result<TokenStream> { | ||
ExpCtxt::new(&ast).expand() | ||
} | ||
|
||
/// The expansion context. | ||
struct ExpCtxt<'ast> { | ||
all_items: Vec<&'ast Item>, | ||
custom_types: HashMap<SolIdent, Type>, | ||
custom_types: IndexMap<SolIdent, Type>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IndexMap
lets us have deterministic iteration and thus output (errors etc).
.enumerate() | ||
.filter(|(_, p)| !p.is_indexed()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#361 title error - enumerate before filter
// trailing comma for single-element tuples | ||
if components.len() == 1 { | ||
out.push(','); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Motivation
Fixes #360
Fixes #361
Fixes #371
Solution
PR Checklist