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

Support StorageMap and StorageVec in complex *storage* types #2465

Closed
mohammadfawaz opened this issue Aug 4, 2022 · 0 comments · Fixed by #4464
Closed

Support StorageMap and StorageVec in complex *storage* types #2465

mohammadfawaz opened this issue Aug 4, 2022 · 0 comments · Fixed by #4464
Assignees
Labels
compiler: codegen Everything to do with IR->ASM, register allocation, etc. compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen compiler: ir IRgen and sway-ir including optimization passes language feature Core language features visible to end users P: medium

Comments

@mohammadfawaz
Copy link
Contributor

For example, it would be nice to be able to write:

struct Wrapper {
    map1: StorageMap<u64, u64> = StorageMap {},
    map2: StorageMap<u64, u64> = StorageMap {},
}

storage {
    wrapper: Wrapper = Wrapper {
        map1: StorageMap {},
        map2: StorageMap {},        
    },
    tuple_wrapper: (StorageVec<u64>, StorageVec<bool>) = (StorageVec {}, StorageVec {}),
    // ... enum example
    // ... array example (once arrays are supported in storage)
}

This requires the __get_storage_key() intrinsic to pass in more information such as the field index in a struct and so on.

This is a follow up on #1796 which is being closed with #2453. #2453 disallow the above until we implement it.

@mohammadfawaz mohammadfawaz added compiler: ir IRgen and sway-ir including optimization passes compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen compiler: codegen Everything to do with IR->ASM, register allocation, etc. language feature Core language features visible to end users labels Aug 4, 2022
@mohammadfawaz mohammadfawaz changed the title Support StorageMap and StorageVec in complex types Support StorageMap and StorageVec in complex _storage_ types Aug 4, 2022
@mohammadfawaz mohammadfawaz changed the title Support StorageMap and StorageVec in complex _storage_ types Support StorageMap and StorageVec in complex *storage* types Aug 4, 2022
@mohammadfawaz mohammadfawaz self-assigned this Feb 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler: codegen Everything to do with IR->ASM, register allocation, etc. compiler: frontend Everything to do with type checking, control flow analysis, and everything between parsing and IRgen compiler: ir IRgen and sway-ir including optimization passes language feature Core language features visible to end users P: medium
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant