From 6378a4ee787ccc99c569fc1429d3900722a79ef0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Mon, 12 Apr 2021 21:11:23 +0200 Subject: [PATCH] Pallet macro support `frame_system::Config` with args (#8606) --- .../procedural/src/pallet/parse/config.rs | 4 ++++ substrate/frame/support/test/tests/pallet.rs | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/substrate/frame/support/procedural/src/pallet/parse/config.rs b/substrate/frame/support/procedural/src/pallet/parse/config.rs index 045f2bff50..79d4680752 100644 --- a/substrate/frame/support/procedural/src/pallet/parse/config.rs +++ b/substrate/frame/support/procedural/src/pallet/parse/config.rs @@ -126,6 +126,10 @@ impl syn::parse::Parse for ConfigBoundParse { input.parse::()?; input.parse::()?; + if input.peek(syn::token::Lt) { + input.parse::()?; + } + Ok(Self(ident)) } } diff --git a/substrate/frame/support/test/tests/pallet.rs b/substrate/frame/support/test/tests/pallet.rs index d78688c88c..24a4990dde 100644 --- a/substrate/frame/support/test/tests/pallet.rs +++ b/substrate/frame/support/test/tests/pallet.rs @@ -365,6 +365,25 @@ pub mod pallet2 { } } +/// Test that the supertrait check works when we pass some parameter to the `frame_system::Config`. +#[frame_support::pallet] +pub mod pallet3 { + use frame_support::pallet_prelude::*; + use frame_system::pallet_prelude::*; + + #[pallet::config] + pub trait Config: frame_system::Config {} + + #[pallet::pallet] + pub struct Pallet(_); + + #[pallet::hooks] + impl Hooks> for Pallet {} + + #[pallet::call] + impl Pallet {} +} + frame_support::parameter_types!( pub const MyGetParam: u32= 10; pub const MyGetParam2: u32= 11;