Skip to content
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: prohibit NEAR function generics #980

Merged
merged 12 commits into from
Jan 23, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ impl AttrSigInfo {
original_attrs: &mut Vec<Attribute>,
original_sig: &mut Signature,
) -> syn::Result<Self> {
if !original_sig.generics.params.is_empty() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's maybe only do this for pub-lic functions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dude, why is this method even being called for private methods 🤔

I am guessing there are two separate logic flows happening in this method: checking that there are no weird variadic async etc modifiers (that is supposed to work on both private and public functions) and processing near_bindgen stuff (only for public functions). I will refactor this.

return Err(Error::new(
original_sig.generics.span(),
"Contract API is not allowed to have generics.",
));
}
if original_sig.asyncness.is_some() {
return Err(Error::new(
original_sig.span(),
Expand Down