Skip to content

Fix issues found during testing of the Iterator implementation for StorageVec #6829

@ironcev

Description

@ironcev

The tests written in #6821 fails for types (), [u64;0], and the EmptyStruct.

Using () causes an ICE:

error
   --> /.../sway/sway-lib-std/src/option.sw:191:15
    |
189 |     /// ```
190 |     pub fn unwrap(self) -> T {
191 |         match self {
    |               ^^^^ Internal compiler error: Failed to get variant type from enum in `unsigned downcast`.
Please file an issue on the repository and include the code that triggered this error.
192 |             Self::Some(inner_value) => inner_value,
193 |             _ => revert(0),
    |

The other two types are zero-sized, and we've already had various issues with such types in the past.

Because of that and the fact that all the tests are passing for all other tested types, it is reasonable to assume that the issues have nothing to do with the implementation of the Iterator trait, but are rather some underlying already existing issues.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcompiler: frontendEverything to do with type checking, control flow analysis, and everything between parsing and IRgenteam:compilerCompiler Team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions