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

Investigate support for other generic Sway types #1421

Open
ra0x3 opened this issue Oct 18, 2023 · 0 comments
Open

Investigate support for other generic Sway types #1421

ra0x3 opened this issue Oct 18, 2023 · 0 comments

Comments

@ra0x3
Copy link
Contributor

ra0x3 commented Oct 18, 2023

  • Might require a bit of investigation
  • Whilst working on chore: add sway app abi tests #1341 I noticed that we currently don't support other generic Sway types
  • While we do support some generic types (i.e., Vec<T> (when it's ready from SDK), Option<T>) there are other generics we don't support:

Example:

enum GenericEnum<T> {
   ValueOne: T
}

struct GenericStruct<T> {
    id: u8,
    value: T,
}

fn some_function() {
    let s = GenericStruct<u64>{ id: 1, value: 2};
    let e = GenericEnum::<bool>::ValueOne(true);
}
  • Technically, if the generic T of some type is indexable, then the entire type should be indexable
  • We would maybe have to think about outlining some constraints/parameters around what we will/won't support
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant