-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Inconsistent ABI metadata types with aliased types #6488
Comments
These types are valid, just don't contain the same amount of information, I don't see a bug here. If you want to compare them for equality or something, you have to use the concrete types. The metadata is produced with best effort from the compiler and not guaranteed to be this consistent. |
I suppose there is an issue in that this is producing types that the SDK isn't used to handling. But I'm not sure if we should make the alias types give you less direct information or have the SDK handle the more complete ones. |
From my understanding of the spec, the metadata type for a tuple would be |
Good point, the spec actually enforces this. We should fix this then. |
Before this push using an alias in a contract would produce an ABI with two distinct metadata types for tuples, one for `(_,_)` and another one for `(u64,u64)`. With this change alias are bypassed and we only produce metadata for the string type of the inner alias type. If alias is `(u64, u64)` we will produce a metadatatype for `(_,_)`. Fixes #6488
Before this push using an alias in a contract would produce an ABI with two distinct metadata types for tuples, one for `(_,_)` and another one for `(u64,u64)`. With this change alias are bypassed and we only produce metadata for the string type of the inner alias type. If alias is `(u64, u64)` we will produce a metadatatype for `(_,_)`. Fixes #6488
Before this push using an alias in a contract would produce an ABI with two distinct metadata types for tuples, one for `(_,_)` and another one for `(u64,u64)`. With this change alias are bypassed and we only produce metadata for the string type of the inner alias type. If alias is `(u64, u64)` we will produce a metadatatype for `(_,_)`. Fixes #6488
Summary
When defining alias types in Sway, we obtain inconsistent results in the generated ABI between inline and alias types.
Consider the following contract:
This came from the following forum post.
Expected
We expect both metadata types to be equal, with a type of
(_, _)
.Actual
We actual get two distinct metadata types, with types as follows:
(_, _)
(u64, u64)
Reproduction
A minimal reproduction can be found here.
The text was updated successfully, but these errors were encountered: