Skip to content

Commit

Permalink
Rename member modules to an inner name. (#4632)
Browse files Browse the repository at this point in the history
  • Loading branch information
orizi authored Dec 21, 2023
1 parent a667722 commit 34923c1
Show file tree
Hide file tree
Showing 36 changed files with 6,632 additions and 6,594 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ mod test_contract {

#[storage]
struct Storage {
my_storage_var: felt252
my_storage_var: felt252,
core: felt252,
}

fn internal_func() -> felt252 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -510,17 +510,17 @@ component:


struct ComponentState<TContractState> {
data: data::ComponentMemberState,
map: map::ComponentMemberState,
my_type_var: my_type_var::ComponentMemberState,
data: __member_module_data::ComponentMemberState,
map: __member_module_map::ComponentMemberState,
my_type_var: __member_module_my_type_var::ComponentMemberState,
}
impl ComponentStateDrop<TContractState> of Drop<ComponentState<TContractState>> {}
#[inline(always)]
fn unsafe_new_component_state<TContractState>() -> ComponentState<TContractState> {
ComponentState::<TContractState> {
data: data::ComponentMemberState {},
map: map::ComponentMemberState {},
my_type_var: my_type_var::ComponentMemberState {},
data: __member_module_data::ComponentMemberState {},
map: __member_module_map::ComponentMemberState {},
my_type_var: __member_module_my_type_var::ComponentMemberState {},
}
}
#[cfg(test)]
Expand All @@ -529,7 +529,7 @@ component:
unsafe_new_component_state::<TContractState>()
}

mod data {
mod __member_module_data {
use super::ContractAddress;
use super::MyTrait;
use super::Event;
Expand All @@ -543,7 +543,7 @@ component:
}
}
}
mod map {
mod __member_module_map {
use super::ContractAddress;
use super::MyTrait;
use super::Event;
Expand All @@ -559,7 +559,7 @@ component:
}
}
}
mod my_type_var {
mod __member_module_my_type_var {
use super::ContractAddress;
use super::MyTrait;
use super::Event;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,13 +293,13 @@ enum Event {}


struct ContractState {
mapping: mapping::ContractMemberState,
mapping: __member_module_mapping::ContractMemberState,
}
impl ContractStateDrop of Drop<ContractState> {}
#[inline(always)]
fn unsafe_new_contract_state() -> ContractState {
ContractState {
mapping: mapping::ContractMemberState {},
mapping: __member_module_mapping::ContractMemberState {},
}
}
#[cfg(test)]
Expand Down Expand Up @@ -374,20 +374,20 @@ error: Plugin diagnostic: Non `LegacyMap` mapping is not yet supported.
mapping: Map::<felt252, felt252>,
^*********************^

error: Plugin diagnostic: Identifier not found.
--> lib.cairo:5:9
mapping: Map::<felt252, felt252>,
^*****^
error: Identifier not found.
--> lib.cairo[contract]:7:18
mapping: __member_module_mapping::ContractMemberState,
^*********************^

error: Invalid drop trait implementation, Candidate impl core::traits::SnapshotDrop::<?0> has an unused generic parameter..
--> lib.cairo[contract]:9:5
impl ContractStateDrop of Drop<ContractState> {}
^**********************************************^

error: Plugin diagnostic: Identifier not found.
--> lib.cairo:5:9
mapping: Map::<felt252, felt252>,
^*****^
error: Identifier not found.
--> lib.cairo[contract]:13:22
mapping: __member_module_mapping::ContractMemberState {},
^*********************^

//! > ==========================================================================

Expand Down Expand Up @@ -1566,7 +1566,7 @@ error: Plugin diagnostic: `raw_output` functions must return `Span::<felt252>`.
//! > Test reusage of storage var name diagnostics.

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

//! > cairo_code
#[starknet::contract]
Expand Down Expand Up @@ -1602,13 +1602,13 @@ enum Event {}


struct ContractState {
same_name: same_name::ContractMemberState,
same_name: __member_module_same_name::ContractMemberState,
}
impl ContractStateDrop of Drop<ContractState> {}
#[inline(always)]
fn unsafe_new_contract_state() -> ContractState {
ContractState {
same_name: same_name::ContractMemberState {},
same_name: __member_module_same_name::ContractMemberState {},
}
}
#[cfg(test)]
Expand All @@ -1617,8 +1617,8 @@ enum Event {}
unsafe_new_contract_state()
}

use same_name::InternalContractMemberStateTrait as same_nameContractMemberStateTrait;
mod same_name {
use __member_module_same_name::InternalContractMemberStateTrait as same_nameContractMemberStateTrait;
mod __member_module_same_name {
#[derive(Copy, Drop)]
struct ContractMemberState {}
trait InternalContractMemberStateTrait {
Expand Down Expand Up @@ -1715,10 +1715,6 @@ impl EventIsEvent of starknet::Event<Event> {
}

//! > expected_diagnostics
error: Plugin diagnostic: The name `same_name` is defined multiple times.
--> lib.cairo:5:9
same_name: felt252,
^*******^

//! > ==========================================================================

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,13 @@ enum Event {}


struct ContractState {
value: value::ContractMemberState,
value: __member_module_value::ContractMemberState,
}
impl ContractStateDrop of Drop<ContractState> {}
#[inline(always)]
fn unsafe_new_contract_state() -> ContractState {
ContractState {
value: value::ContractMemberState {},
value: __member_module_value::ContractMemberState {},
}
}
#[cfg(test)]
Expand All @@ -143,8 +143,8 @@ enum Event {}
unsafe_new_contract_state()
}

use value::InternalContractMemberStateTrait as valueContractMemberStateTrait;
mod value {
use __member_module_value::InternalContractMemberStateTrait as valueContractMemberStateTrait;
mod __member_module_value {
#[derive(Copy, Drop)]
struct ContractMemberState {}
trait InternalContractMemberStateTrait {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,18 @@ enum Event {}


struct ContractState {
balance: balance::ContractMemberState,
balance: __member_module_balance::ContractMemberState,
}
impl ContractStateDrop of Drop<ContractState> {}
#[inline(always)]
fn unsafe_new_contract_state() -> ContractState {
ContractState {
balance: balance::ContractMemberState {},
balance: __member_module_balance::ContractMemberState {},
}
}

use balance::InternalContractMemberStateTrait as balanceContractMemberStateTrait;
mod balance {
use __member_module_balance::InternalContractMemberStateTrait as balanceContractMemberStateTrait;
mod __member_module_balance {
use super::HelloStarknetImpl;
#[derive(Copy, Drop)]
struct ContractMemberState {}
Expand Down Expand Up @@ -529,18 +529,18 @@ enum Event {}


struct ContractState {
balance: balance::ContractMemberState,
balance: __member_module_balance::ContractMemberState,
}
impl ContractStateDrop of Drop<ContractState> {}
#[inline(always)]
fn unsafe_new_contract_state() -> ContractState {
ContractState {
balance: balance::ContractMemberState {},
balance: __member_module_balance::ContractMemberState {},
}
}

use balance::InternalContractMemberStateTrait as balanceContractMemberStateTrait;
mod balance {
use __member_module_balance::InternalContractMemberStateTrait as balanceContractMemberStateTrait;
mod __member_module_balance {
use super::HelloStarknetImpl;
#[derive(Copy, Drop)]
struct ContractMemberState {}
Expand Down
Loading

0 comments on commit 34923c1

Please sign in to comment.