Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type alias name is missing in types #6564

Open
nedsalk opened this issue Sep 18, 2024 · 0 comments
Open

Type alias name is missing in types #6564

nedsalk opened this issue Sep 18, 2024 · 0 comments
Labels
bug Something isn't working triage This issue was opened with a template and needs to be triaged by code owners.

Comments

@nedsalk
Copy link

nedsalk commented Sep 18, 2024

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
@nedsalk nedsalk added bug Something isn't working triage This issue was opened with a template and needs to be triaged by code owners. labels Sep 18, 2024
@nedsalk nedsalk changed the title Type alias name is missing for tuples Type alias name is missing in types Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage This issue was opened with a template and needs to be triaged by code owners.
Projects
None yet
Development

No branches or pull requests

1 participant