Skip to content

Commit

Permalink
hooks default impl missing where clause (paritytech#13264)
Browse files Browse the repository at this point in the history
* hooks default impl missing where clause

* add tests

* Update frame/support/test/tests/pallet_ui/pass/where_clause_missing_hooks.rs

---------

Co-authored-by: parity-processbot <>
  • Loading branch information
kianenigma authored and nathanwhit committed Jul 19, 2023
1 parent 18e18a7 commit 26dfe7d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion frame/support/procedural/src/pallet/expand/hooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ pub fn expand_hooks(def: &mut Def) -> proc_macro2::TokenStream {
quote::quote! {
impl<#type_impl_gen>
#frame_support::traits::Hooks<<T as #frame_system::Config>::BlockNumber>
for Pallet<#type_use_gen> {}
for #pallet_ident<#type_use_gen> #where_clause {}
}
} else {
proc_macro2::TokenStream::new()
Expand Down
3 changes: 1 addition & 2 deletions frame/support/test/tests/pallet_ui/duplicate_store_attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,4 @@ mod pallet {
type Foo<T> = StorageValue<_, u8>;
}

fn main() {
}
fn main() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#[frame_support::pallet]
mod pallet {
#[pallet::config]
pub trait Config: frame_system::Config where <Self as frame_system::Config>::Index: From<u128> {}

#[pallet::pallet]
pub struct Pallet<T>(core::marker::PhantomData<T>);

#[pallet::call]
impl<T: Config> Pallet<T> where <T as frame_system::Config>::Index: From<u128> {}

impl<T: Config> Pallet<T> where <T as frame_system::Config>::Index: From<u128> {
fn foo(x: u128) {
let _index = <T as frame_system::Config>::Index::from(x);
}
}
}

fn main() {}

0 comments on commit 26dfe7d

Please sign in to comment.