forked from dwallet-labs/dwallet-network
-
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] Add freezing for tail expressions (#15588)
## Description There was a small oversight in freezing bound expressions in tail positions introduced during the HLIR rewrite. The VM validator caught the issue, but it would be nice to allow this code since it's valid Move. ## Test Plan Added a new test file to cover the behavior. --- If your changes are not user-facing and not a breaking change, you can skip the following section. Otherwise, please indicate what changed, and then add to the Release Notes section as highlighted during the release process. ### Type of Change (Check all that apply) - [ ] protocol change - [ ] user-visible impact - [ ] breaking change for a client SDKs - [ ] breaking change for FNs (FN binary must upgrade) - [ ] breaking change for validators or node operators (must upgrade binaries) - [ ] breaking change for on-chain data layout - [ ] necessitate either a data wipe or data migration ### Release notes
- Loading branch information
Showing
2 changed files
with
50 additions
and
4 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
41 changes: 41 additions & 0 deletions
41
external-crates/move/crates/move-compiler/tests/move_2024/hlir/tail_block_freeze.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,41 @@ | ||
module a::m { | ||
|
||
public struct S {} | ||
|
||
fun t0(s: &mut S): &S { | ||
loop { | ||
break s | ||
} | ||
} | ||
|
||
fun t1(s: &mut S): &S { | ||
'block: { | ||
s | ||
} | ||
} | ||
|
||
#[allow(dead_code)] | ||
fun t2(s: &mut S): &S { | ||
'block: { | ||
return 'block s; | ||
s | ||
} | ||
} | ||
|
||
fun t3(s: &mut S): &S { | ||
{ | ||
s | ||
} | ||
} | ||
|
||
fun t4(s: &mut S): &S { | ||
{ | ||
s | ||
} | ||
} | ||
|
||
fun t5(s: &mut S): &S { | ||
if (true) { s } else { s } | ||
} | ||
|
||
} |