Skip to content

Commit 96c923f

Browse files
committed
Deduplicate external contracts by full path
1 parent 6b3c801 commit 96c923f

File tree

1 file changed

+10
-1
lines changed
  • scarb/src/compiler/compilers/starknet_contract

1 file changed

+10
-1
lines changed

scarb/src/compiler/compilers/starknet_contract/compiler.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -332,9 +332,18 @@ pub fn find_project_contracts(
332332
Vec::new()
333333
};
334334

335-
Ok(internal_contracts
335+
// Deduplicate found contracts by contract path.
336+
let mut contracts_found = internal_contracts
336337
.into_iter()
337338
.chain(external_contracts)
339+
.map(|decl| (decl.module_id().full_path(db.upcast()), decl))
340+
.sorted_by_key(|(path, _)| path.clone())
341+
.collect_vec();
342+
contracts_found.dedup_by_key(|(path, _)| path.clone());
343+
344+
Ok(contracts_found
345+
.into_iter()
346+
.map(|(_path, decl)| decl)
338347
.collect())
339348
}
340349

0 commit comments

Comments
 (0)