-
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.
add ability check on number constraints
- Loading branch information
1 parent
dbdb613
commit b9355c7
Showing
10 changed files
with
168 additions
and
14 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
8 changes: 4 additions & 4 deletions
8
...ty/move/move-compiler-v2/tests/ability-check/v1-typing/pack_constraint_not_satisfied2.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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
|
||
Diagnostics: | ||
bug: unexpected type: _ | ||
┌─ tests/ability-check/v1-typing/pack_constraint_not_satisfied2.move:6:9 | ||
error: constraint `integer` does not have required ability `key` | ||
┌─ tests/ability-check/v1-typing/pack_constraint_not_satisfied2.move:7:27 | ||
│ | ||
6 │ fun t0() { | ||
│ ^^ | ||
7 │ R {r:_ } = R { r: 0 }; | ||
│ ^ |
50 changes: 50 additions & 0 deletions
50
third_party/move/move-compiler-v2/tests/bytecode-generator/bug_14629.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,50 @@ | ||
// -- Model dump before bytecode pipeline | ||
module 0x8675309::M { | ||
struct R<T> { | ||
r: T, | ||
} | ||
struct X<T> { | ||
r: T, | ||
} | ||
private fun t0() { | ||
{ | ||
let y: R<X<u64>> = pack M::R<X<u64>>(pack M::X<u64>(0)); | ||
{ | ||
let M::R<X<u64>>{ r: _r } = y; | ||
Tuple() | ||
} | ||
} | ||
} | ||
} // end 0x8675309::M | ||
|
||
// -- Sourcified model before bytecode pipeline | ||
module 0x8675309::M { | ||
struct R<T: key> { | ||
r: T, | ||
} | ||
struct X<T> has drop, key { | ||
r: T, | ||
} | ||
fun t0() { | ||
let y = R<X<u64>>{r: X<u64>{r: 0}}; | ||
let R<X<u64>>{r: _r} = y; | ||
} | ||
} | ||
|
||
============ initial bytecode ================ | ||
|
||
[variant baseline] | ||
fun M::t0() { | ||
var $t0: 0x8675309::M::R<0x8675309::M::X<u64>> | ||
var $t1: 0x8675309::M::X<u64> | ||
var $t2: u64 | ||
var $t3: 0x8675309::M::X<u64> | ||
0: $t2 := 0 | ||
1: $t1 := pack 0x8675309::M::X<u64>($t2) | ||
2: $t0 := pack 0x8675309::M::R<0x8675309::M::X<u64>>($t1) | ||
3: $t3 := unpack 0x8675309::M::R<0x8675309::M::X<u64>>($t0) | ||
4: return () | ||
} | ||
|
||
|
||
============ bytecode verification succeeded ======== |
14 changes: 14 additions & 0 deletions
14
third_party/move/move-compiler-v2/tests/bytecode-generator/bug_14629.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 0x8675309::M { | ||
// struct Coin {} | ||
struct R<T: key> { r: T } | ||
struct X<T> has key, drop { | ||
r: T | ||
} | ||
// struct S<T: drop> has drop { c: T } | ||
|
||
fun t0() { | ||
let y = R { r: X { r: 0} }; | ||
let R { r: _r } = y; | ||
// S { c: Coin {} }; | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
third_party/move/move-compiler-v2/tests/bytecode-generator/bug_14629_fail.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,7 @@ | ||
|
||
Diagnostics: | ||
error: constraint `integer` does not have required ability `key` | ||
┌─ tests/bytecode-generator/bug_14629_fail.move:6:32 | ||
│ | ||
6 │ let R { r: _ } = R {r: 0}; | ||
│ ^ |
8 changes: 8 additions & 0 deletions
8
third_party/move/move-compiler-v2/tests/bytecode-generator/bug_14629_fail.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,8 @@ | ||
module 0x8675309::M { | ||
// struct Coin {} | ||
struct R<T: key> { r: T } | ||
|
||
fun t1() { | ||
let R { r: _ } = R {r: 0}; | ||
} | ||
} |
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