-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
156 additions
and
3 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
third_party/move/move-compiler-v2/tests/bytecode-generator/wildcard1.exp
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
35 changes: 35 additions & 0 deletions
35
third_party/move/move-compiler-v2/tests/bytecode-generator/wildcard5.exp
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,35 @@ | ||
// -- Model dump before bytecode pipeline | ||
module 0xc0ffee::m { | ||
struct S { | ||
x: u64, | ||
y: u64, | ||
} | ||
public fun test() { | ||
{ | ||
let s: m::S = pack m::S(3, 4); | ||
{ | ||
let m::S{ x: _, y: _ }: m::S = s; | ||
Tuple() | ||
} | ||
} | ||
} | ||
} // end 0xc0ffee::m | ||
|
||
============ initial bytecode ================ | ||
|
||
[variant baseline] | ||
public fun m::test() { | ||
var $t0: m::S | ||
var $t1: u64 | ||
var $t2: u64 | ||
var $t3: u64 | ||
var $t4: u64 | ||
0: $t1 := 3 | ||
1: $t2 := 4 | ||
2: $t0 := pack m::S($t1, $t2) | ||
3: ($t3, $t4) := unpack m::S($t0) | ||
4: return () | ||
} | ||
|
||
|
||
============ bytecode verification succeeded ======== |
11 changes: 11 additions & 0 deletions
11
third_party/move/move-compiler-v2/tests/bytecode-generator/wildcard5.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,11 @@ | ||
module 0xc0ffee::m { | ||
struct S { | ||
x: u64, | ||
y: u64 | ||
} | ||
|
||
public fun test() { | ||
let s = S {x: 3, y: 4}; | ||
let S {x: _, y: _} = s; | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
third_party/move/move-compiler-v2/tests/bytecode-generator/wildcard6.exp
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,39 @@ | ||
// -- Model dump before bytecode pipeline | ||
module 0xc0ffee::m { | ||
public fun test2(): u64 { | ||
{ | ||
let x: u64 = 40; | ||
{ | ||
let (y: u64, _): (u64, u64) = Tuple(Move(x), x); | ||
y | ||
} | ||
} | ||
} | ||
} // end 0xc0ffee::m | ||
|
||
============ initial bytecode ================ | ||
|
||
[variant baseline] | ||
public fun m::test2(): u64 { | ||
var $t0: u64 | ||
var $t1: u64 | ||
var $t2: u64 | ||
var $t3: u64 | ||
var $t4: u64 | ||
0: $t1 := 40 | ||
1: $t3 := move($t1) | ||
2: $t2 := infer($t3) | ||
3: $t4 := infer($t1) | ||
4: $t0 := infer($t2) | ||
5: return $t0 | ||
} | ||
|
||
|
||
Diagnostics: | ||
error: cannot move local `x` since it is still in use | ||
┌─ tests/bytecode-generator/wildcard6.move:4:23 | ||
│ | ||
4 │ let (y, _) = (move x, x); | ||
│ ------ ^^^^^^ attempted to move here | ||
│ │ | ||
│ used here |
7 changes: 7 additions & 0 deletions
7
third_party/move/move-compiler-v2/tests/bytecode-generator/wildcard6.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,7 @@ | ||
module 0xc0ffee::m { | ||
public fun test2(): u64 { | ||
let x = 40; | ||
let (y, _) = (move x, x); | ||
y | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
third_party/move/move-compiler-v2/tests/bytecode-generator/wildcard7.exp
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,52 @@ | ||
|
||
Diagnostics: | ||
warning: Unused local variable `q`. Consider removing or prefixing with an underscore: `_q` | ||
┌─ tests/bytecode-generator/wildcard7.move:6:17 | ||
│ | ||
6 │ let (_, q) = (x, z); | ||
│ ^ | ||
|
||
// -- Model dump before bytecode pipeline | ||
module 0xc0ffee::m { | ||
public fun test(): u8 { | ||
{ | ||
let x: u8 = 40; | ||
{ | ||
let y: u8 = Move(x); | ||
{ | ||
let (_, q: u64): (u8, u64) = Tuple(x, 30); | ||
y | ||
} | ||
} | ||
} | ||
} | ||
} // end 0xc0ffee::m | ||
|
||
============ initial bytecode ================ | ||
|
||
[variant baseline] | ||
public fun m::test(): u8 { | ||
var $t0: u8 | ||
var $t1: u8 | ||
var $t2: u8 | ||
var $t3: u64 | ||
var $t4: u8 | ||
var $t5: u64 | ||
0: $t1 := 40 | ||
1: $t2 := move($t1) | ||
2: $t4 := infer($t1) | ||
3: $t5 := 30 | ||
4: $t3 := infer($t5) | ||
5: $t0 := infer($t2) | ||
6: return $t0 | ||
} | ||
|
||
|
||
Diagnostics: | ||
error: cannot move local `x` since it is still in use | ||
┌─ tests/bytecode-generator/wildcard7.move:5:17 | ||
│ | ||
5 │ let y = move x; | ||
│ ^^^^^^ attempted to move here | ||
6 │ let (_, q) = (x, z); | ||
│ ------ used here |
9 changes: 9 additions & 0 deletions
9
third_party/move/move-compiler-v2/tests/bytecode-generator/wildcard7.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,9 @@ | ||
module 0xc0ffee::m { | ||
public fun test(): u8 { | ||
let x = 40; | ||
let z = 30; | ||
let y = move x; | ||
let (_, q) = (x, z); | ||
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