File tree 2 files changed +15
-2
lines changed
src/compiler/compilers/starknet_contract
2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -332,9 +332,18 @@ pub fn find_project_contracts(
332
332
Vec :: new ( )
333
333
} ;
334
334
335
- Ok ( internal_contracts
335
+ // Deduplicate found contracts by contract path.
336
+ let mut contracts_found = internal_contracts
336
337
. into_iter ( )
337
338
. 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)
338
347
. collect ( ) )
339
348
}
340
349
Original file line number Diff line number Diff line change @@ -572,7 +572,11 @@ fn can_dedup_contract_reexports() {
572
572
[[target.starknet-contract]]
573
573
"# } )
574
574
. dep_starknet ( )
575
- . lib_cairo ( "pub mod a; pub use a::Balance;" )
575
+ . lib_cairo ( indoc ! { r#"
576
+ // Note that Balance contract can be accessed both through mod tree and the reexport.
577
+ pub mod a;
578
+ pub use a::Balance;
579
+ "# } )
576
580
. src ( "src/a.cairo" , BALANCE_CONTRACT )
577
581
. build ( & hello) ;
578
582
You can’t perform that action at this time.
0 commit comments