@@ -15,11 +15,16 @@ use sway_types::{integer_bits::IntegerBits, BaseIdent, Ident, Span, Spanned};
15
15
use crate :: {
16
16
decl_engine:: {
17
17
parsed_id:: ParsedDeclId , DeclEngineGet , DeclEngineGetParsedDeclId , DeclEngineInsert ,
18
- } , engine_threading:: * , language:: {
18
+ } ,
19
+ engine_threading:: * ,
20
+ language:: {
19
21
parsed:: { EnumDeclaration , ImplItem , StructDeclaration } ,
20
22
ty:: { self , TyDecl , TyImplItem , TyTraitItem } ,
21
23
CallPath ,
22
- } , type_system:: { SubstTypes , TypeId } , IncludeSelf , SubstTypesContext , TraitConstraint , TypeArgument , TypeEngine , TypeInfo , TypeParameter , TypeSubstMap , UnifyCheck
24
+ } ,
25
+ type_system:: { SubstTypes , TypeId } ,
26
+ IncludeSelf , SubstTypesContext , TraitConstraint , TypeArgument , TypeEngine , TypeInfo ,
27
+ TypeParameter , TypeSubstMap , UnifyCheck ,
23
28
} ;
24
29
25
30
use super :: Module ;
@@ -97,14 +102,18 @@ type TraitName = Arc<CallPath<TraitSuffix>>;
97
102
pub ( crate ) struct TraitKey {
98
103
pub ( crate ) name : TraitName ,
99
104
pub ( crate ) type_id : TypeId ,
105
+ pub ( crate ) impl_type_parameters : Vec < TypeParameter > ,
100
106
pub ( crate ) trait_decl_span : Option < Span > ,
101
107
}
102
108
103
109
impl OrdWithEngines for TraitKey {
104
110
fn cmp ( & self , other : & Self , ctx : & OrdWithEnginesContext ) -> std:: cmp:: Ordering {
105
- self . name
106
- . cmp ( & other. name , ctx)
107
- . then_with ( || self . type_id . cmp ( & other. type_id ) )
111
+ self . name . cmp ( & other. name , ctx) . then_with ( || {
112
+ self . type_id . cmp ( & other. type_id ) . then_with ( || {
113
+ self . impl_type_parameters
114
+ . cmp ( & other. impl_type_parameters , ctx)
115
+ } )
116
+ } )
108
117
}
109
118
}
110
119
@@ -225,7 +234,7 @@ impl TraitMap {
225
234
trait_name : CallPath ,
226
235
trait_type_args : Vec < TypeArgument > ,
227
236
type_id : TypeId ,
228
- _impl_type_parameters : Vec < TypeParameter > ,
237
+ impl_type_parameters : Vec < TypeParameter > ,
229
238
items : & [ ResolvedTraitImplItem ] ,
230
239
impl_span : & Span ,
231
240
trait_decl_span : Option < Span > ,
@@ -272,6 +281,7 @@ impl TraitMap {
272
281
name : map_trait_name,
273
282
type_id : map_type_id,
274
283
trait_decl_span : _,
284
+ impl_type_parameters : _,
275
285
} ,
276
286
value :
277
287
TraitValue {
@@ -439,6 +449,7 @@ impl TraitMap {
439
449
impl_span. clone ( ) ,
440
450
trait_decl_span,
441
451
type_id,
452
+ impl_type_parameters,
442
453
trait_items,
443
454
engines,
444
455
) ;
@@ -447,19 +458,22 @@ impl TraitMap {
447
458
} )
448
459
}
449
460
461
+ #[ allow( clippy:: too_many_arguments) ]
450
462
fn insert_inner (
451
463
& mut self ,
452
464
trait_name : TraitName ,
453
465
impl_span : Span ,
454
466
trait_decl_span : Option < Span > ,
455
467
type_id : TypeId ,
468
+ impl_type_parameters : Vec < TypeParameter > ,
456
469
trait_methods : TraitItems ,
457
470
engines : & Engines ,
458
471
) {
459
472
let key = TraitKey {
460
473
name : trait_name,
461
474
type_id,
462
475
trait_decl_span,
476
+ impl_type_parameters,
463
477
} ;
464
478
let value = TraitValue {
465
479
trait_items : trait_methods,
@@ -639,6 +653,7 @@ impl TraitMap {
639
653
name : map_trait_name,
640
654
type_id : map_type_id,
641
655
trait_decl_span : map_trait_decl_span,
656
+ impl_type_parameters : map_impl_type_parameters,
642
657
} ,
643
658
value :
644
659
TraitValue {
@@ -654,6 +669,7 @@ impl TraitMap {
654
669
impl_span. clone ( ) ,
655
670
map_trait_decl_span. clone ( ) ,
656
671
* type_id,
672
+ map_impl_type_parameters. clone ( ) ,
657
673
map_trait_items. clone ( ) ,
658
674
engines,
659
675
) ;
@@ -663,6 +679,7 @@ impl TraitMap {
663
679
impl_span. clone ( ) ,
664
680
map_trait_decl_span. clone ( ) ,
665
681
* map_type_id,
682
+ map_impl_type_parameters. clone ( ) ,
666
683
Self :: filter_dummy_methods (
667
684
map_trait_items. clone ( ) ,
668
685
* type_id,
0 commit comments