FuelLabs / FuelLabs/sway

Follow alphabetical order in enums and in their corresponding `match` statements all over the compiler

Open
#1,685 0 comments 0 reactions 0 assignees View on GitHub
code quality compiler: codegen compiler: frontend compiler: parser team:compiler
Dominant language
Rust
Stars
61.4k
Forks
5.4k
Avg merge
3h 33m
Merged PRs (30d)
4

Description

This may or may not make sense in some situations, but for the most part, it would be nice to have everything ordered alphabetically. This brings consistency and improves code readability.

e.g. https://github.com/FuelLabs/sway/blob/a3b9cee7aa0acf8b6a671f4304e6f7526cc6c768/sway-core/src/semantic_analysis/ast_node/declaration.rs#L27-L34

I think we already this properly in the `sway-ir` crate.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the cited declaration.rs example in the sway-core crate, then inspect the surrounding enum and corresponding match statement. Compare the existing ordering with the sway-ir crate, and identify compiler-wide cases where alphabetical ordering is appropriate. Done means relevant enums and their matches follow a consistent alphabetical order, with exceptions handled where ordering does not make sense.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.