-
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
1 parent
16f59a3
commit 7ad3d51
Showing
24 changed files
with
653 additions
and
376 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
7 changes: 7 additions & 0 deletions
7
third_party/move/move-compiler-v2/tests/ability-check/index_ability_err.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: value of type `test::Y<test::X<bool>>` does not have the `copy` ability | ||
┌─ tests/ability-check/index_ability_err.move:12:17 | ||
│ | ||
12 │ let _ = Y<X<bool>>[addr]; | ||
│ ^^^^^^^^^^^^^^^^ reference content copied here |
15 changes: 15 additions & 0 deletions
15
third_party/move/move-compiler-v2/tests/ability-check/index_ability_err.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,15 @@ | ||
module 0x42::test { | ||
|
||
struct X<M> has copy, drop, store { | ||
value: M | ||
} | ||
struct Y<T> has key, drop { | ||
field: T | ||
} | ||
|
||
fun test_resource_no_copy() acquires Y { | ||
let addr = @0x1; | ||
let _ = Y<X<bool>>[addr]; | ||
} | ||
|
||
} |
7 changes: 7 additions & 0 deletions
7
third_party/move/move-compiler-v2/tests/ability-check/index_ability_err_2.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: resource indexing can only applied to a resource type (a struct type which has key ability) | ||
┌─ tests/ability-check/index_ability_err_2.move:9:17 | ||
│ | ||
9 │ let _ = X<bool>[addr]; | ||
│ ^^^^^^^^^^^^^ |
12 changes: 12 additions & 0 deletions
12
third_party/move/move-compiler-v2/tests/ability-check/index_ability_err_2.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,12 @@ | ||
module 0x42::test { | ||
|
||
struct X<M> has copy, drop, store { | ||
value: M | ||
} | ||
|
||
fun test_struct_no_resource() acquires X { | ||
let addr = @0x1; | ||
let _ = X<bool>[addr]; | ||
} | ||
|
||
} |
91 changes: 91 additions & 0 deletions
91
third_party/move/move-compiler-v2/tests/checking-lang-v1/index.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,91 @@ | ||
|
||
Diagnostics: | ||
error: unsupported language construct | ||
┌─ tests/checking-lang-v1/index.move:11:17 | ||
│ | ||
11 │ assert!((test::R[@0x1]).value == true, 0); | ||
│ ^^^^^^^^^^^^^^^ `_[_]` index operator in non-specification code only allowed in Move 2 and beyond | ||
|
||
error: unsupported language construct | ||
┌─ tests/checking-lang-v1/index.move:15:9 | ||
│ | ||
15 │ 0x42::test::R[@0x1].value = false; | ||
│ ^^^^^^^^^^^^^^^^^^^ `_[_]` index operator in non-specification code only allowed in Move 2 and beyond | ||
|
||
error: unsupported language construct | ||
┌─ tests/checking-lang-v1/index.move:16:17 | ||
│ | ||
16 │ assert!(R[@0x1].value == false, 1); | ||
│ ^^^^^^^ `_[_]` index operator in non-specification code only allowed in Move 2 and beyond | ||
|
||
error: unsupported language construct | ||
┌─ tests/checking-lang-v1/index.move:38:17 | ||
│ | ||
38 │ assert!(test::Y<X<bool>>[@0x1].field.value == true, 0); | ||
│ ^^^^^^^^^^^^^^^^^^^^^^ `_[_]` index operator in non-specification code only allowed in Move 2 and beyond | ||
|
||
error: unsupported language construct | ||
┌─ tests/checking-lang-v1/index.move:43:22 | ||
│ | ||
43 │ let y = &mut 0x42::test ::Y<X<bool>> [addr]; | ||
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `_[_]` index operator in non-specification code only allowed in Move 2 and beyond | ||
|
||
error: unsupported language construct | ||
┌─ tests/checking-lang-v1/index.move:45:17 | ||
│ | ||
45 │ assert!(Y<X<bool>>[addr].field.value == false, 1); | ||
│ ^^^^^^^^^^^^^^^^ `_[_]` index operator in non-specification code only allowed in Move 2 and beyond | ||
|
||
error: unsupported language construct | ||
┌─ tests/checking-lang-v1/index.move:53:17 | ||
│ | ||
53 │ assert!(v[0].value == 2, 0); | ||
│ ^^^^ `_[_]` index operator in non-specification code only allowed in Move 2 and beyond | ||
|
||
error: unsupported language construct | ||
┌─ tests/checking-lang-v1/index.move:70:17 | ||
│ | ||
70 │ assert!(v[0].field.value == true, 0); | ||
│ ^^^^ `_[_]` index operator in non-specification code only allowed in Move 2 and beyond | ||
|
||
error: unsupported language construct | ||
┌─ tests/checking-lang-v1/index.move:71:17 | ||
│ | ||
71 │ assert!(v[1].field.value == false, 0); | ||
│ ^^^^ `_[_]` index operator in non-specification code only allowed in Move 2 and beyond | ||
|
||
error: unsupported language construct | ||
┌─ tests/checking-lang-v1/index.move:88:17 | ||
│ | ||
88 │ assert!(v[0].field.value == true, 0); | ||
│ ^^^^ `_[_]` index operator in non-specification code only allowed in Move 2 and beyond | ||
|
||
error: unsupported language construct | ||
┌─ tests/checking-lang-v1/index.move:89:17 | ||
│ | ||
89 │ assert!(v[1].field.value == false, 0); | ||
│ ^^^^ `_[_]` index operator in non-specification code only allowed in Move 2 and beyond | ||
|
||
error: unsupported language construct | ||
┌─ tests/checking-lang-v1/index.move:90:9 | ||
│ | ||
90 │ v[0].field.value = false; | ||
│ ^^^^ `_[_]` index operator in non-specification code only allowed in Move 2 and beyond | ||
|
||
error: unsupported language construct | ||
┌─ tests/checking-lang-v1/index.move:91:9 | ||
│ | ||
91 │ v[1].field.value = true; | ||
│ ^^^^ `_[_]` index operator in non-specification code only allowed in Move 2 and beyond | ||
|
||
error: unsupported language construct | ||
┌─ tests/checking-lang-v1/index.move:92:17 | ||
│ | ||
92 │ assert!(v[0].field.value == false, 0); | ||
│ ^^^^ `_[_]` index operator in non-specification code only allowed in Move 2 and beyond | ||
|
||
error: unsupported language construct | ||
┌─ tests/checking-lang-v1/index.move:93:17 | ||
│ | ||
93 │ assert!(v[1].field.value == true, 0); | ||
│ ^^^^ `_[_]` index operator in non-specification code only allowed in Move 2 and beyond |
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
20 changes: 7 additions & 13 deletions
20
third_party/move/move-compiler-v2/tests/checking/typing/index_err.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,19 +1,13 @@ | ||
|
||
Diagnostics: | ||
error: unexpected token | ||
┌─ tests/checking/typing/index_err.move:10:17 | ||
│ | ||
10 │ assert!((test::R[@0x1]).value == true, 0); | ||
│ ^^^^^^^^^^^^^^^ resource indexing using `_[_]` needs to be paired with `&` or `&mut` | ||
|
||
error: unexpected token | ||
error: indexing can only be applied to a vector or a resource type (a struct type which has key ability) | ||
┌─ tests/checking/typing/index_err.move:14:9 | ||
│ | ||
14 │ Test[@0x1]; | ||
│ ^^^^^^^^^^ index notation `_[_]` expects a resource or vector | ||
14 │ UNUSED_Test[@0x1]; | ||
│ ^^^^^^^^^^^^^^^^^ | ||
|
||
error: unexpected token | ||
┌─ tests/checking/typing/index_err.move:19:10 | ||
error: indexing can only be applied to a vector or a resource type (a struct type which has key ability) | ||
┌─ tests/checking/typing/index_err.move:19:9 | ||
│ | ||
19 │ &test::Test[@0x1]; | ||
│ ^^^^^^^^^^^^^^^^ index notation `_[_]` expects a resource or vector | ||
19 │ &test::UNUSED_Test[@0x1]; | ||
│ ^^^^^^^^^^^^^^^^^^^^^^^^ |
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
4 changes: 2 additions & 2 deletions
4
third_party/move/move-compiler-v2/tests/checking/typing/index_err_2.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: | ||
error: cannot pass `&X<integer>` to a function which expects argument of type `&vector<_>` | ||
error: expected `vector<struct{value}>` but found a value of type `X<integer>` | ||
┌─ tests/checking/typing/index_err_2.move:11:17 | ||
│ | ||
11 │ assert!(x[0].value == 2, 0); | ||
│ ^^^^ | ||
│ ^ |
28 changes: 28 additions & 0 deletions
28
third_party/move/move-compiler-v2/tests/file-format-generator/index_acquires_err.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,28 @@ | ||
|
||
Diagnostics: | ||
error: Invalid operation: storage operation on type `test::Y` can only be done within the defining module `0x42::test` | ||
┌─ tests/file-format-generator/index_acquires_err.move:14:9 | ||
│ | ||
14 │ fun test_resource_other_module() acquires 0x42::test::Y { | ||
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
15 │ let addr = @0x1; | ||
16 │ assert!((&0x42::test::Y<0x42::test::X<bool>>[addr]).field.value == true, 1); | ||
│ ------------------------------------------- called here | ||
|
||
error: Invalid operation: access of the field `field` on type `test::Y` can only be done within the defining module `0x42::test` | ||
┌─ tests/file-format-generator/index_acquires_err.move:14:9 | ||
│ | ||
14 │ fun test_resource_other_module() acquires 0x42::test::Y { | ||
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
15 │ let addr = @0x1; | ||
16 │ assert!((&0x42::test::Y<0x42::test::X<bool>>[addr]).field.value == true, 1); | ||
│ ------------------------------------------------- accessed here | ||
|
||
error: Invalid operation: access of the field `value` on type `test::X` can only be done within the defining module `0x42::test` | ||
┌─ tests/file-format-generator/index_acquires_err.move:14:9 | ||
│ | ||
14 │ fun test_resource_other_module() acquires 0x42::test::Y { | ||
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
15 │ let addr = @0x1; | ||
16 │ assert!((&0x42::test::Y<0x42::test::X<bool>>[addr]).field.value == true, 1); | ||
│ ------------------------------------------------------- accessed here |
23 changes: 23 additions & 0 deletions
23
third_party/move/move-compiler-v2/tests/file-format-generator/index_acquires_err.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,23 @@ | ||
module 0x42::test { | ||
|
||
struct X<M> has copy, drop, store { | ||
value: M | ||
} | ||
struct Y<T> has key, drop { | ||
field: T | ||
} | ||
|
||
} | ||
|
||
module 0x42::test2 { | ||
|
||
fun test_resource_other_module() acquires 0x42::test::Y { | ||
let addr = @0x1; | ||
assert!((&0x42::test::Y<0x42::test::X<bool>>[addr]).field.value == true, 1); | ||
spec { | ||
// This is OK | ||
assert 0x42::test::Y<0x42::test::X<bool>>[addr].field.value == true; | ||
} | ||
} | ||
|
||
} |
28 changes: 28 additions & 0 deletions
28
third_party/move/move-compiler-v2/tests/file-format-generator/index_acquires_err.opt.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,28 @@ | ||
|
||
Diagnostics: | ||
error: Invalid operation: storage operation on type `test::Y` can only be done within the defining module `0x42::test` | ||
┌─ tests/file-format-generator/index_acquires_err.move:14:9 | ||
│ | ||
14 │ fun test_resource_other_module() acquires 0x42::test::Y { | ||
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
15 │ let addr = @0x1; | ||
16 │ assert!((&0x42::test::Y<0x42::test::X<bool>>[addr]).field.value == true, 1); | ||
│ ------------------------------------------- called here | ||
|
||
error: Invalid operation: access of the field `field` on type `test::Y` can only be done within the defining module `0x42::test` | ||
┌─ tests/file-format-generator/index_acquires_err.move:14:9 | ||
│ | ||
14 │ fun test_resource_other_module() acquires 0x42::test::Y { | ||
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
15 │ let addr = @0x1; | ||
16 │ assert!((&0x42::test::Y<0x42::test::X<bool>>[addr]).field.value == true, 1); | ||
│ ------------------------------------------------- accessed here | ||
|
||
error: Invalid operation: access of the field `value` on type `test::X` can only be done within the defining module `0x42::test` | ||
┌─ tests/file-format-generator/index_acquires_err.move:14:9 | ||
│ | ||
14 │ fun test_resource_other_module() acquires 0x42::test::Y { | ||
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
15 │ let addr = @0x1; | ||
16 │ assert!((&0x42::test::Y<0x42::test::X<bool>>[addr]).field.value == true, 1); | ||
│ ------------------------------------------------------- accessed here |
2 changes: 1 addition & 1 deletion
2
third_party/move/move-compiler-v2/transactional-tests/tests/no-v1-comparison/index.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 +1 @@ | ||
processed 14 tasks | ||
processed 21 tasks |
Oops, something went wrong.