diff --git a/crates/cgp-macro-lib/src/cgp_fn/substitute_type.rs b/crates/cgp-macro-lib/src/cgp_fn/substitute_type.rs index dbcd2d0c..b078e2d9 100644 --- a/crates/cgp-macro-lib/src/cgp_fn/substitute_type.rs +++ b/crates/cgp-macro-lib/src/cgp_fn/substitute_type.rs @@ -34,9 +34,11 @@ pub fn substitute_abstract_type( && let Some(replacement_ident) = type_spec.replace_ident(&ident) { let trait_path = &type_spec.trait_path; + out.extend(quote! { < #context_type as #trait_path > :: #replacement_ident }); + replaced_ident = true; break; } diff --git a/crates/cgp-macro-lib/src/cgp_fn/use_type.rs b/crates/cgp-macro-lib/src/cgp_fn/use_type.rs index 1cf7aa0d..08901872 100644 --- a/crates/cgp-macro-lib/src/cgp_fn/use_type.rs +++ b/crates/cgp-macro-lib/src/cgp_fn/use_type.rs @@ -18,7 +18,9 @@ impl UseTypeSpec { pub fn replace_ident(&self, ident: &Ident) -> Option { for type_ident in &self.type_idents { if type_ident.replacement_ident() == ident { - return Some(type_ident.type_ident.clone()); + let mut new_ident = type_ident.type_ident.clone(); + new_ident.set_span(ident.span()); + return Some(new_ident); } }