Skip to content

Commit 06c3560

Browse files
committed
Generate aliasOf field when processing aliased types for ABI generation.
1 parent 54d01f1 commit 06c3560

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

sway-core/src/abi_generation/fuel_abi.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,11 +427,27 @@ fn generate_concrete_type_declaration(
427427

428428
let (type_field, concrete_type_id) =
429429
type_id.get_abi_type_field_and_concrete_id(handler, ctx, engines, resolved_type_id)?;
430+
431+
let type_engine = engines.te();
432+
let alias_of = match &*type_engine.get(resolved_type_id) {
433+
TypeInfo::Alias { ty, .. } => {
434+
// Ensure the underlying representation has a declaration first
435+
let target_ctid = generate_concrete_type_declaration(
436+
handler,
437+
ctx,
438+
engines,
439+
metadata_types,
440+
concrete_types,
441+
ty.initial_type_id(),
442+
ty.type_id(),
443+
)?;
444+
Some(target_ctid)
430445
let concrete_type_decl = TypeConcreteDeclaration {
431446
type_field,
432447
concrete_type_id: concrete_type_id.clone(),
433448
metadata_type_id,
434449
type_arguments,
450+
alias_of,
435451
};
436452

437453
concrete_types.push(concrete_type_decl);

0 commit comments

Comments
 (0)