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 2024] Method syntax docs (MystenLabs#16760)
## Description Book chapter for methods ## Test Plan - 👓 --- 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: ronny-mysten <[email protected]>
- Loading branch information
1 parent
75bc597
commit 93709f7
Showing
6 changed files
with
490 additions
and
8 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
external-crates/move/crates/move-compiler/tests/move_2024/naming/use_fun_shadows.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,24 @@ | ||
module a::m { | ||
public struct X() has copy, drop; | ||
public fun u(_: &X): u64 { 0 } | ||
public fun b(_: &X): bool { false } | ||
} | ||
|
||
module b::other { | ||
use a::m::X; | ||
|
||
use fun a::m::u as X.f; | ||
|
||
fun example(x: &X) { | ||
let _: u64 = x.f(); | ||
{ | ||
use a::m::b as f; | ||
let _: bool = x.f(); | ||
}; | ||
let _: u64 = x.f(); | ||
{ | ||
use fun a::m::b as X.f; | ||
let _: bool = x.f(); | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
external-crates/move/crates/move-compiler/tests/move_2024/typing/by_value_method.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,14 @@ | ||
module a::m { | ||
public struct X() has copy, drop; | ||
public fun by_val(_: X) {} | ||
public fun by_ref(_: &X) {} | ||
public fun by_mut(_: &mut X) {} | ||
|
||
public struct Y { x: X } | ||
public fun drop_y(y: Y) { let Y { x: _ } = y; } | ||
|
||
fun example(y: Y) { | ||
y.x.by_val(); | ||
y.drop_y(); | ||
} | ||
} |
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
Oops, something went wrong.