Skip to content

Commit

Permalink
[move][move-2024][matching] Preserve int subject annotation during ma…
Browse files Browse the repository at this point in the history
…tch pattern typing (#19973)

## Description 

Preserve int subject annotation during match pattern typing

## Test plan 

New tests pass

---

## 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 Oct 23, 2024
1 parent 72a6e25 commit 3a4089d
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1612,7 +1612,7 @@ fn exp(context: &mut Context, ne: Box<N::Exp>) -> Box<T::Exp> {
}
};
let result_type = core::make_tvar(context, aloc);
let earms = match_arms(context, &subject_type, &result_type, narms_, &ref_mut);
let earms = match_arms(context, &esubject.ty, &result_type, narms_, &ref_mut);
(result_type, TE::Match(esubject, sp(aloc, earms)))
}
NE::While(name, nb, nloop) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module a::m;

fun t0() {
let x = 2 + 5;
match (x) { _ => {} }
}

fun t1() {
match ({ 2 + 3 + 4}) { _ => {} }
}

fun t2() {
match ({ let x = 2 + 3; x + 4}) { _ => {} }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module a::m;

fun t() {
match (&mut 10) { _ => {} }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module a::m;

fun t() {
match (&10) { _ => {} }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module a::m;

fun t() {
match (10) { _ => {} }
}

0 comments on commit 3a4089d

Please sign in to comment.