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

bug: code annotated with cfg(test) included in build #4897

Closed
Serhii-Braavos opened this issue Jan 24, 2024 · 0 comments · Fixed by #4909
Closed

bug: code annotated with cfg(test) included in build #4897

Serhii-Braavos opened this issue Jan 24, 2024 · 0 comments · Fixed by #4909
Labels
bug Something isn't working

Comments

@Serhii-Braavos
Copy link

Bug Report

Cairo version:

2.5.0 (was fine in 2.2.0)

Current behavior:

Contract that includes implementation annotated with #[cfg(test)] doesn't compile.
Works fine when running scarb test

Related code:

Code example:

#[cfg(test)]
#[starknet::interface]
trait ITests<TContractState> {
    fn set_value(ref self: TContractState, value: felt252);
}


#[starknet::contract]
mod MyContract {
    #[storage]
    struct Storage {
        value: felt252
    }

    #[cfg(test)]
    #[abi(embed_v0)]
    impl TestsImpl of super::ITests<ContractState> {
        fn set_value(ref self: ContractState, value: felt252) {
            self.value.write(value);
        }
    }
}

scarb build output:

error: Plugin diagnostic: Identifier not found.
 --> ...cairo:121:10
    impl TestsImpl of super::ITests<ContractState> {
         ^*******^


error: Identifier not found.
 --> ...cairo[contract]:24:20
        use super::TestsImpl;
                   ^*******^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant