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

Added forwarding of attributes in generated structs and enums. #6739

Merged
merged 1 commit into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! > Test expansion of a basic component.

//! > test_runner_name
ExpandContractTestRunner(expect_diagnostics: warnings_only)
ExpandContractTestRunner(expect_diagnostics: false)

//! > cairo_code
#[derive(Drop, starknet::Store)]
Expand All @@ -17,6 +17,7 @@ mod component {
#[storage]
struct Storage {
data: u32,
#[feature("deprecated_legacy_map")]
map: LegacyMap<u32, u32>,
my_type_var: super::MyType,
}
Expand Down Expand Up @@ -66,6 +67,7 @@ mod component {
#[storage]
struct Storage {
data: u32,
#[feature("deprecated_legacy_map")]
map: LegacyMap<u32, u32>,
my_type_var: super::MyType,
}
Expand Down Expand Up @@ -186,7 +188,7 @@ impl MyTypeSubPointersMutImpl of starknet::storage::SubPointersMut<MyType> {
}


lib.cairo:41:1
lib.cairo:42:1
#[starknet::interface]
^********************^
MyTraitDispatcherTrait:
Expand Down Expand Up @@ -375,7 +377,7 @@ impl MyTypeSubPointersMutDrop of core::traits::Drop::<MyTypeSubPointersMut>;
impl MyTypeSubPointersMutCopy of core::traits::Copy::<MyTypeSubPointersMut>;


lib.cairo:41:1
lib.cairo:42:1
#[starknet::interface]
^********************^
impls:
Expand All @@ -394,7 +396,7 @@ impl MyTraitDispatcherSerde of core::serde::Serde::<MyTraitDispatcher> {
}


lib.cairo:41:1
lib.cairo:42:1
#[starknet::interface]
^********************^
starknet_derive:
Expand Down Expand Up @@ -473,7 +475,7 @@ impl MyTraitDispatcherSubPointersMutImpl of starknet::storage::SubPointersMut<My
}


lib.cairo:41:1
lib.cairo:42:1
#[starknet::interface]
^********************^
impls:
Expand All @@ -492,7 +494,7 @@ impl MyTraitLibraryDispatcherSerde of core::serde::Serde::<MyTraitLibraryDispatc
}


lib.cairo:41:1
lib.cairo:42:1
#[starknet::interface]
^********************^
starknet_derive:
Expand Down Expand Up @@ -571,7 +573,7 @@ impl MyTraitLibraryDispatcherSubPointersMutImpl of starknet::storage::SubPointer
}


lib.cairo:41:1
lib.cairo:42:1
#[starknet::interface]
^********************^
impls:
Expand All @@ -590,7 +592,7 @@ impl MyTraitSafeLibraryDispatcherSerde of core::serde::Serde::<MyTraitSafeLibrar
}


lib.cairo:41:1
lib.cairo:42:1
#[starknet::interface]
^********************^
starknet_derive:
Expand Down Expand Up @@ -669,7 +671,7 @@ impl MyTraitSafeLibraryDispatcherSubPointersMutImpl of starknet::storage::SubPoi
}


lib.cairo:41:1
lib.cairo:42:1
#[starknet::interface]
^********************^
impls:
Expand All @@ -688,7 +690,7 @@ impl MyTraitSafeDispatcherSerde of core::serde::Serde::<MyTraitSafeDispatcher> {
}


lib.cairo:41:1
lib.cairo:42:1
#[starknet::interface]
^********************^
starknet_derive:
Expand Down Expand Up @@ -767,7 +769,7 @@ impl MyTraitSafeDispatcherSubPointersMutImpl of starknet::storage::SubPointersMu
}


lib.cairo:41:1
lib.cairo:42:1
#[starknet::interface]
^********************^
impls:
Expand All @@ -776,7 +778,7 @@ impl MyTraitDispatcherSubPointersDrop of core::traits::Drop::<MyTraitDispatcherS
impl MyTraitDispatcherSubPointersCopy of core::traits::Copy::<MyTraitDispatcherSubPointers>;


lib.cairo:41:1
lib.cairo:42:1
#[starknet::interface]
^********************^
impls:
Expand All @@ -785,7 +787,7 @@ impl MyTraitDispatcherSubPointersMutDrop of core::traits::Drop::<MyTraitDispatch
impl MyTraitDispatcherSubPointersMutCopy of core::traits::Copy::<MyTraitDispatcherSubPointersMut>;


lib.cairo:41:1
lib.cairo:42:1
#[starknet::interface]
^********************^
impls:
Expand All @@ -794,7 +796,7 @@ impl MyTraitLibraryDispatcherSubPointersDrop of core::traits::Drop::<MyTraitLibr
impl MyTraitLibraryDispatcherSubPointersCopy of core::traits::Copy::<MyTraitLibraryDispatcherSubPointers>;


lib.cairo:41:1
lib.cairo:42:1
#[starknet::interface]
^********************^
impls:
Expand All @@ -803,7 +805,7 @@ impl MyTraitLibraryDispatcherSubPointersMutDrop of core::traits::Drop::<MyTraitL
impl MyTraitLibraryDispatcherSubPointersMutCopy of core::traits::Copy::<MyTraitLibraryDispatcherSubPointersMut>;


lib.cairo:41:1
lib.cairo:42:1
#[starknet::interface]
^********************^
impls:
Expand All @@ -812,7 +814,7 @@ impl MyTraitSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::<MyTrait
impl MyTraitSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::<MyTraitSafeLibraryDispatcherSubPointers>;


lib.cairo:41:1
lib.cairo:42:1
#[starknet::interface]
^********************^
impls:
Expand All @@ -821,7 +823,7 @@ impl MyTraitSafeLibraryDispatcherSubPointersMutDrop of core::traits::Drop::<MyTr
impl MyTraitSafeLibraryDispatcherSubPointersMutCopy of core::traits::Copy::<MyTraitSafeLibraryDispatcherSubPointersMut>;


lib.cairo:41:1
lib.cairo:42:1
#[starknet::interface]
^********************^
impls:
Expand All @@ -830,7 +832,7 @@ impl MyTraitSafeDispatcherSubPointersDrop of core::traits::Drop::<MyTraitSafeDis
impl MyTraitSafeDispatcherSubPointersCopy of core::traits::Copy::<MyTraitSafeDispatcherSubPointers>;


lib.cairo:41:1
lib.cairo:42:1
#[starknet::interface]
^********************^
impls:
Expand All @@ -849,6 +851,7 @@ component:
#[phantom]
pub struct Storage {
pub data: u32,
#[feature("deprecated_legacy_map")]
pub map: LegacyMap<u32, u32>,
pub my_type_var: super::MyType,
}
Expand All @@ -857,6 +860,7 @@ pub struct Storage {
#[doc(hidden)]
pub struct StorageStorageBase {
pub data: starknet::storage::StorageBase<u32>,
#[feature("deprecated_legacy_map")]
pub map: starknet::storage::StorageBase<LegacyMap<u32, u32>>,
pub my_type_var: starknet::storage::StorageBase<super::MyType>,
}
Expand All @@ -878,6 +882,7 @@ impl StorageStorageImpl of starknet::storage::StorageTrait<Storage> {
#[doc(hidden)]
pub struct StorageStorageBaseMut {
pub data: starknet::storage::StorageBase<starknet::storage::Mutable::<u32>>,
#[feature("deprecated_legacy_map")]
pub map: starknet::storage::StorageBase<starknet::storage::Mutable::<LegacyMap<u32, u32>>>,
pub my_type_var: starknet::storage::StorageBase<starknet::storage::Mutable::<super::MyType>>,
}
Expand Down Expand Up @@ -956,15 +961,15 @@ impl TContractStateDrop: Drop<TContractState>
}
}

lib.cairo:19:14
lib.cairo:20:14
#[derive(Drop, starknet::Event)]
^**^
impls:

impl EventDrop of core::traits::Drop::<Event>;


lib.cairo:19:20
lib.cairo:20:20
#[derive(Drop, starknet::Event)]
^*************^
starknet_derive:
Expand Down Expand Up @@ -1003,15 +1008,15 @@ impl EventLogIntoEvent of Into<Log, Event> {



lib.cairo:23:14
lib.cairo:24:14
#[derive(Drop, starknet::Event)]
^**^
impls:

impl LogDrop of core::traits::Drop::<Log>;


lib.cairo:23:20
lib.cairo:24:20
#[derive(Drop, starknet::Event)]
^*************^
starknet_derive:
Expand Down Expand Up @@ -1047,7 +1052,7 @@ impl StorageStorageBaseMutDrop of core::traits::Drop::<StorageStorageBaseMut>;
impl StorageStorageBaseMutCopy of core::traits::Copy::<StorageStorageBaseMut>;


lib.cairo:26:5
lib.cairo:27:5
#[embeddable_as(MyImpl)]
^**********************^
embeddable:
Expand Down Expand Up @@ -1123,7 +1128,3 @@ pub mod __constructor_MyImpl {
}

//! > expected_diagnostics
warning: Usage of deprecated feature `"deprecated_legacy_map"` with no `#[feature("deprecated_legacy_map")]` attribute. Note: "Use `starknet::storage::Map` instead."
--> lib.cairo:14:14
map: LegacyMap<u32, u32>,
^*******^
Original file line number Diff line number Diff line change
Expand Up @@ -8161,6 +8161,7 @@ pub struct Storage {
#[derive(Drop, Copy)]
#[doc(hidden)]
pub struct StorageStorageBase {
#[substorage(v0)]
pub component_storage: starknet::storage::FlattenedStorage<super::component::Storage>,
}
#[doc(hidden)]
Expand All @@ -8176,6 +8177,7 @@ impl StorageStorageImpl of starknet::storage::StorageTrait<Storage> {
#[derive(Drop, Copy)]
#[doc(hidden)]
pub struct StorageStorageBaseMut {
#[substorage(v0)]
pub component_storage: starknet::storage::FlattenedStorage<starknet::storage::Mutable::<super::component::Storage>>,
}
#[doc(hidden)]
Expand All @@ -8190,6 +8192,7 @@ impl StorageStorageMutImpl of starknet::storage::StorageTraitMut<Storage> {
}

pub struct ContractState {
#[substorage(v0)]
pub component_storage: super::component::ComponentState<ContractState>,
}

Expand Down Expand Up @@ -12718,6 +12721,7 @@ pub struct Storage {
#[derive(Drop, Copy)]
#[doc(hidden)]
pub struct StorageStorageBase {
#[substorage(v0)]
pub component_member: starknet::storage::FlattenedStorage<super::test_component::Storage>,
}
#[doc(hidden)]
Expand All @@ -12733,6 +12737,7 @@ impl StorageStorageImpl of starknet::storage::StorageTrait<Storage> {
#[derive(Drop, Copy)]
#[doc(hidden)]
pub struct StorageStorageBaseMut {
#[substorage(v0)]
pub component_member: starknet::storage::FlattenedStorage<starknet::storage::Mutable::<super::test_component::Storage>>,
}
#[doc(hidden)]
Expand All @@ -12747,6 +12752,7 @@ impl StorageStorageMutImpl of starknet::storage::StorageTraitMut<Storage> {
}

pub struct ContractState {
#[substorage(v0)]
pub component_member: super::test_component::ComponentState<ContractState>,
}

Expand Down Expand Up @@ -14674,6 +14680,7 @@ pub struct Storage {
#[derive(Drop, Copy)]
#[doc(hidden)]
pub struct StorageStorageBase {
#[substorage(v0)]
pub component_storage: starknet::storage::FlattenedStorage<super::component::Storage>,
}
#[doc(hidden)]
Expand All @@ -14689,6 +14696,7 @@ impl StorageStorageImpl of starknet::storage::StorageTrait<Storage> {
#[derive(Drop, Copy)]
#[doc(hidden)]
pub struct StorageStorageBaseMut {
#[substorage(v0)]
pub component_storage: starknet::storage::FlattenedStorage<starknet::storage::Mutable::<super::component::Storage>>,
}
#[doc(hidden)]
Expand All @@ -14703,6 +14711,7 @@ impl StorageStorageMutImpl of starknet::storage::StorageTraitMut<Storage> {
}

pub struct ContractState {
#[substorage(v0)]
pub component_storage: super::component::ComponentState<ContractState>,
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ impl StoreA of starknet::Store::<A> {
#[doc(hidden)]
pub struct ASubPointers {
pub x: starknet::storage::StoragePointer<felt252>,
#[key]
pub data: starknet::storage::StoragePointer<usize>,
}
#[doc(hidden)]
Expand Down Expand Up @@ -188,6 +189,7 @@ impl ASubPointersImpl of starknet::storage::SubPointers<A> {
#[doc(hidden)]
pub struct ASubPointersMut {
pub x: starknet::storage::StoragePointer<starknet::storage::Mutable::<felt252>>,
#[key]
pub data: starknet::storage::StoragePointer<starknet::storage::Mutable::<usize>>,
}
#[doc(hidden)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1504,6 +1504,7 @@ pub struct Storage {
#[derive(Drop, Copy)]
#[doc(hidden)]
pub struct StorageStorageBase {
#[substorage(v0)]
pub comp_storage: starknet::storage::FlattenedStorage<super::comp::Storage>,
}
#[doc(hidden)]
Expand All @@ -1519,6 +1520,7 @@ impl StorageStorageImpl of starknet::storage::StorageTrait<Storage> {
#[derive(Drop, Copy)]
#[doc(hidden)]
pub struct StorageStorageBaseMut {
#[substorage(v0)]
pub comp_storage: starknet::storage::FlattenedStorage<starknet::storage::Mutable::<super::comp::Storage>>,
}
#[doc(hidden)]
Expand All @@ -1533,6 +1535,7 @@ impl StorageStorageMutImpl of starknet::storage::StorageTraitMut<Storage> {
}

pub struct ContractState {
#[substorage(v0)]
pub comp_storage: super::comp::ComponentState<ContractState>,
}

Expand Down
Loading