Skip to content

Commit

Permalink
[move-2024] Method syntax for sui-framework (#16754)
Browse files Browse the repository at this point in the history
## Description 

Stacked on #16466  (and also #16634 as a result)

This translates `sui-framework` to Move 2024.

Public use funs:

```
sources/balance.move
10:    public use fun sui::coin::from_balance as Balance.into_coin;

sources/kiosk/kiosk.move
97:    public use fun kiosk_owner_cap_for as KioskOwnerCap.kiosk;

sources/coin.move
16:    public use fun sui::pay::split_vec as Coin.split_vec;
19:    public use fun sui::pay::join_vec as Coin.join_vec;
22:    public use fun sui::pay::split_and_transfer as Coin.split_and_transfer;
25:    public use fun sui::pay::divide_and_keep as Coin.divide_and_keep;

sources/object.move
19:    public use fun id_to_address as ID.to_address;
22:    public use fun id_to_bytes as ID.to_bytes;
25:    public use fun uid_as_inner as UID.as_inner;
28:    public use fun uid_to_inner as UID.to_inner;
31:    public use fun uid_to_address as UID.to_address;
34:    public use fun uid_to_bytes as UID.to_bytes;

sources/address.move
12:    public use fun sui::object::id_from_address as address.to_id;
```

## Test Plan 

Tests are unchanged. Note that many of the tests may be rewritten to
also use method syntax, but this change is already large enough that it
seemed prudent to do the tests in a separate diff.

---
If your changes are not user-facing and do not break anything, you can
skip the following section. Otherwise, please briefly describe what has
changed under the Release Notes section.

### 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

---------

Co-authored-by: Todd Nowacki <[email protected]>
  • Loading branch information
cgswords and tnowacki authored Mar 25, 2024
1 parent b0f2884 commit e30dc9e
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions crates/move-model/src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -718,12 +718,9 @@ impl GlobalEnv {
/// TODO: move-compiler should use FileId as well so we don't need this here. There is already
/// a todo in their code to remove the current use of `&'static str` for file names in Loc.
pub fn to_loc(&self, loc: &MoveIrLoc) -> Loc {
let file_id = self.get_file_id(loc.file_hash()).unwrap_or_else(|| {
panic!(
"Unable to find source file '{}' in the environment",
loc.file_hash()
)
});
let Some(file_id) = self.get_file_id(loc.file_hash()) else {
return self.unknown_loc();
};
Loc {
file_id,
span: Span::new(loc.start(), loc.end()),
Expand Down

0 comments on commit e30dc9e

Please sign in to comment.