Skip to content

Commit

Permalink
[move][move-2024] Fix match bug, rework work queue from match for san…
Browse files Browse the repository at this point in the history
…ity (#20247)

## Description 

Fix a bug, plus a bit of yak shaving: this removes the work queue from
match compilation in favor of `growing_stack`, for the purpose of
sanity. This refactor was actually sufficient (along with one small
change) to eliminate the bug.

## Test plan 

All tests still pass, plus the new ones.

---

## Release notes

Check each box that your changes affect. If none of the boxes relate to
your changes, release notes aren't required.

For each box you select, include information after the relevant heading
that describes the impact of your changes that a user might notice and
any actions they must take to implement updates.

- [ ] Protocol: 
- [ ] Nodes (Validators and Full nodes): 
- [ ] Indexer: 
- [ ] JSON-RPC: 
- [ ] GraphQL: 
- [ ] CLI: 
- [ ] Rust SDK:
- [ ] REST API:
  • Loading branch information
cgswords authored Nov 18, 2024
1 parent da3ef34 commit b60a0bf
Show file tree
Hide file tree
Showing 9 changed files with 778 additions and 409 deletions.
644 changes: 274 additions & 370 deletions external-crates/move/crates/move-compiler/src/hlir/match_compilation.rs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -517,9 +517,10 @@ impl PatternMatrix {
.any(|pat| pat.is_wild_arm() && pat.guard.is_none())
}

pub fn wild_arm_opt(&mut self, fringe: &VecDeque<FringeEntry>) -> Option<Vec<ArmResult>> {
pub fn wild_tree_opt(&mut self, fringe: &VecDeque<FringeEntry>) -> Option<Vec<ArmResult>> {
// NB: If the first row is all wild, we need to collect _all_ wild rows that have guards
// until we find one that does not.
// until we find one that does not. If we do not find one without a guard, then this isn't
// a wild tree.
if let Some(arm) = self.patterns[0].all_wild_arm(fringe) {
if arm.guard.is_none() {
return Some(vec![arm]);
Expand All @@ -534,7 +535,7 @@ impl PatternMatrix {
}
}
}
Some(result)
None
} else {
None
}
Expand Down
Loading

0 comments on commit b60a0bf

Please sign in to comment.