Skip to content

Commit c66cd2b

Browse files
committed
Generate aliasOf field when processing aliased types for ABI generation.
1 parent 9261828 commit c66cd2b

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

sway-core/src/abi_generation/fuel_abi.rs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,12 +658,31 @@ fn generate_concrete_type_declaration(
658658

659659
let (type_field, concrete_type_id) =
660660
type_id.get_abi_type_field_and_concrete_id(handler, ctx, engines, resolved_type_id)?;
661+
662+
let type_engine = engines.te();
663+
let alias_of = match &*type_engine.get(resolved_type_id) {
664+
TypeInfo::Alias { ty, .. } => {
665+
// Ensure the underlying representation has a declaration first
666+
let target_ctid = generate_concrete_type_declaration(
667+
handler,
668+
ctx,
669+
engines,
670+
metadata_types,
671+
concrete_types,
672+
ty.initial_type_id(),
673+
ty.type_id(),
674+
)?;
675+
Some(target_ctid)
676+
}
677+
_ => None,
678+
};
679+
661680
let concrete_type_decl = TypeConcreteDeclaration {
662681
type_field,
663682
concrete_type_id: concrete_type_id.clone(),
664683
metadata_type_id,
665684
type_arguments,
666-
alias_of: None,
685+
alias_of,
667686
};
668687

669688
concrete_types.push(concrete_type_decl);

0 commit comments

Comments
 (0)