Skip to content

Commit 8265985

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

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

sway-core/src/abi_generation/fuel_abi.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -649,11 +649,31 @@ fn generate_concrete_type_declaration(
649649

650650
let (type_field, concrete_type_id) =
651651
type_id.get_abi_type_field_and_concrete_id(handler, ctx, engines, resolved_type_id)?;
652+
653+
let type_engine = engines.te();
654+
let alias_of = match &*type_engine.get(resolved_type_id) {
655+
TypeInfo::Alias { ty, .. } => {
656+
// Ensure the underlying representation has a declaration first
657+
let target_ctid = generate_concrete_type_declaration(
658+
handler,
659+
ctx,
660+
engines,
661+
metadata_types,
662+
concrete_types,
663+
ty.initial_type_id(),
664+
ty.type_id(),
665+
)?;
666+
Some(target_ctid)
667+
}
668+
_ => None,
669+
};
670+
652671
let concrete_type_decl = TypeConcreteDeclaration {
653672
type_field,
654673
concrete_type_id: concrete_type_id.clone(),
655674
metadata_type_id,
656675
type_arguments,
676+
alias_of,
657677
};
658678

659679
concrete_types.push(concrete_type_decl);

0 commit comments

Comments
 (0)