forked from MystenLabs/sui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[move][move-2024] Match typing fix (MystenLabs#20584)
## Description This fixes a bug where some match arms' final type was computed based on the inner arm, instead of the expected output type. ## Test plan New tests past --- ## 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
Showing
5 changed files
with
99 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
external-crates/move/crates/move-compiler/tests/move_2024/matching/const_lit.move
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module 0x0::variable_undefined; | ||
|
||
const V_1: u8 = 0; | ||
const V_2: u8 = 1; | ||
|
||
public fun get_v1(a: u8): u8 { | ||
match (a) { | ||
V_1 => 10, | ||
V_2 => 20, | ||
_ => abort, | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
external-crates/move/crates/move-compiler/tests/move_2024/matching/const_lit_bool.move
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module 0x0::variable_undefined; | ||
|
||
const V_1: bool = true; | ||
const V_2: bool = false; | ||
|
||
public fun get_v1(a: bool): bool { | ||
match (a) { | ||
V_1 => true, | ||
V_2 => false, | ||
_ => abort, | ||
} | ||
} |