Skip to content

Type alias name is missing in types #6564

@nedsalk

Description

@nedsalk

Related Component

forc

Problem

For the program in the steps below, the aliased type name is missing from the types in the generated json abi. I made some sample aliased types, but I believe that it's a general problem for all aliases.

I came across it when FuelLabs/fuels-ts#3032. It's not a showstopper, it's just that the types won't be shown to the end user under the alias but rather as the actual type the alias is pointing to (e.g. not AliasedString but the equivalent of str[5] which is string in our case).

Steps

contract;

struct MyStruct {
    a: u32,
}

type AliasedTuple = (AssetId, u32);
type AliasedArray = [u32; 4];
type AliasedString = str[5];
type AliasedStruct = MyStruct;

abi MyContract {
    fn aliased_tuple(input: AliasedTuple) -> u32;
    fn aliased_array(input: AliasedArray) -> u32;
    fn aliased_string(input: AliasedString) -> u32;
    fn aliased_struct(input: AliasedStruct) -> u32;
}

impl MyContract for Contract {
    fn aliased_tuple(input: AliasedTuple) -> u32 {
        4
    }
    fn aliased_array(input: AliasedArray) -> u32 {
        4
    }
    fn aliased_string(input: AliasedString) -> u32 {
        4
    }
    fn aliased_struct(input: AliasedStruct) -> u32 {
        4
    }
}

Possible Solution(s)

No response

Notes

No response

Installed components

- forc 0.63.5

Metadata

Metadata

Assignees

Labels

ABIEverything to do the ABI, especially the JSON representationbugSomething isn't workingteam:compilerCompiler Team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions