-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Open
Labels
DCAEverything to do with Dead Code AnalysisEverything to do with Dead Code AnalysisbugSomething isn't workingSomething isn't workingcompilerGeneral compiler. Should eventually become more specific as the issue is triagedGeneral compiler. Should eventually become more specific as the issue is triagedcompiler: uiMostly compiler messagesMostly compiler messagesteam:compilerCompiler TeamCompiler Team
Description
If you have 2 namespaces, the namespace will only check the first ABI in a contract. If the storage variable is used in a second ABI within the contract, the compiler will still issue a warning.
Secondly, storage variables that are not used in a second namespace does not issue warnings.
Minimal Repro:
contract;
storage {
v1 {
my_storage_var: u64 = 0, // This is warned as not used but is used in MySecondABI
},
v2 {
my_storage_var: u64 = 0, // This is not used at all and never receives a warning
},
}
abi MyFirstABI {
fn test_function_1() -> bool;
}
abi MySecondABI {
#[storage(read, write)]
fn test_function_2() -> bool;
}
// This abi does not use storage.
impl MyFirstABI for Contract {
fn test_function_1() -> bool {
true
}
}
// This abi uses storage
impl MySecondABI for Contract {
#[storage(read, write)]
fn test_function_2() -> bool {
let my_var = storage::v1.my_storage_var.read();
log(my_var);
storage::v1.my_storage_var.write(1);
true
}
}
Metadata
Metadata
Assignees
Labels
DCAEverything to do with Dead Code AnalysisEverything to do with Dead Code AnalysisbugSomething isn't workingSomething isn't workingcompilerGeneral compiler. Should eventually become more specific as the issue is triagedGeneral compiler. Should eventually become more specific as the issue is triagedcompiler: uiMostly compiler messagesMostly compiler messagesteam:compilerCompiler TeamCompiler Team