fix(macro): use FQDNs when calling contract methods #1186
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hey Team!
I've noticed a small inconsistency while working on
#[access_control]
from near-plugins, which uses#[near-sdk::near]
macro internally.The inconsistency itself can be described as follows:
To simplify the issue, consider the following example:
When you compile it with
cargo build --target wasm32-unknown-unknown
, you get the following error:This happens due to
method
is not implemented onContract itself
but is a part ofimpl other::SomeTrait for Contract
, so it's not visible in the current scope.Of course, It can be fixed by adding
use other::SomeTrait
at top of your module, but it's better to avoid it, so it can just work.The current version of
near-sdk 5.1.0
generates following code:This PR introduces a fix for that by using fully qualified syntax for calling methods that are part of trait implementation.
Here is the code that this PR generates: