You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Currently, when an #[dojo::interface] is defined, we inject automatically the self: @ContractState into the functions it contains. Same for the world, if a function contains world: IWorldDispatcher as it's first argument, we inline it.
The issue with that, is when we have internal functions or standalone function, we're applying this rule everywhere.
To Reproduce
Write a simple function into a contract that takes no argument, and when you try to call it, it will ask for an argument (being self). Also, if you have an internal implementation with a function that takes world: IWorldDispatcher as argument, it will be removed and cause compilation error.
Expected behavior
The inlining of the world: IWorldDispatcher and the auto management of world: IWorldDispatcher must only be done for #[dojo::interfaces] implementations.
Describe the bug
Currently, when an
#[dojo::interface]
is defined, we inject automatically theself: @ContractState
into the functions it contains. Same for the world, if a function containsworld: IWorldDispatcher
as it's first argument, we inline it.The issue with that, is when we have internal functions or standalone function, we're applying this rule everywhere.
To Reproduce
Write a simple function into a contract that takes no argument, and when you try to call it, it will ask for an argument (being
self
). Also, if you have an internal implementation with a function that takesworld: IWorldDispatcher
as argument, it will be removed and cause compilation error.Expected behavior
The inlining of the
world: IWorldDispatcher
and the auto management ofworld: IWorldDispatcher
must only be done for#[dojo::interfaces]
implementations.The related code for contract macro is here:
dojo/crates/dojo-lang/src/contract.rs
Line 223 in 48e7261
And the one for interfaces here:
dojo/crates/dojo-lang/src/interface.rs
Line 81 in 48e7261
The text was updated successfully, but these errors were encountered: