Skip to content

Commit

Permalink
[move-compiler-v2] Add all remaining V1 tests to V2, except evm/async (
Browse files Browse the repository at this point in the history
…#14578)

* add options and plumbing for compile_verify_code, warn_deprecated, etc., and add final set of V1 tests to V2, except flavor tests (evm/async)
* move around and edit/split tests to test same functionality in V2 as V1
  • Loading branch information
brmataptos authored Sep 19, 2024
1 parent eab8d27 commit 2b208e5
Show file tree
Hide file tree
Showing 953 changed files with 13,535 additions and 1,432 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

Diagnostics:
error: value of type `M::R` does not have the `drop` ability
┌─ tests/ability-check/typing/assign_unpack_references.move:17:33
17 │ R { s1: S { f }, s2 } = &R { s1: S{f: 0}, s2: S{f: 1} }; f; s2;
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ still borrowed but will be implicitly dropped later since it is no longer used

error: value of type `M::R` does not have the `drop` ability
┌─ tests/ability-check/typing/assign_unpack_references.move:27:33
27 │ R { s1: S { f }, s2 } = &mut R { s1: S{f: 0}, s2: S{f: 1} }; f; s2;
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ still borrowed but will be implicitly dropped later since it is no longer used
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

Diagnostics:
error: value of type `M::R` does not have the `drop` ability
┌─ tests/ability-check/typing/bind_unpack_references.move:13:41
13 │ let R { s1: S { f }, s2 }: &R = &R { s1: S{f: 0}, s2: S{f: 1} }; f; s2;
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ still borrowed but will be implicitly dropped later since it is no longer used

error: value of type `M::R` does not have the `drop` ability
┌─ tests/ability-check/typing/bind_unpack_references.move:20:45
20 │ let R { s1: S { f }, s2 }: &mut R = &mut R { s1: S{f: 0}, s2: S{f: 1} }; f; s2;
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ still borrowed but will be implicitly dropped later since it is no longer used
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

Diagnostics:
error: value of type `M::R` does not have the `drop` ability
┌─ tests/ability-check/typing/borrow_local_temp_resource.move:6:9
6 │ &R{};
│ ^^^^ implicitly dropped here since it is no longer used

error: value of type `M::R` does not have the `drop` ability
┌─ tests/ability-check/typing/borrow_local_temp_resource.move:7:9
7 │ &mut R{};
│ ^^^^^^^^ implicitly dropped here since it is no longer used
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@

Diagnostics:
error: local `r` of type `M::R` does not have the `copy` ability
┌─ tests/ability-check/typing/derefrence_reference.move:6:16
6 │ R {} = *r;
│ ^^ reference content copied here

error: local `b` of type `M::B` does not have the `copy` ability
┌─ tests/ability-check/typing/derefrence_reference.move:7:24
7 │ B { r: R{} } = *b;
│ ^^ reference content copied here

error: value of type `M::R` does not have the `copy` ability
┌─ tests/ability-check/typing/derefrence_reference.move:8:17
8 │ R{} = *&b.r;
│ ^^^ reference content copied here

error: local `r` of type `M::R` does not have the `copy` ability
┌─ tests/ability-check/typing/derefrence_reference.move:12:16
12 │ R {} = *r;
│ ^^ reference content copied here

error: local `b` of type `M::B` does not have the `copy` ability
┌─ tests/ability-check/typing/derefrence_reference.move:13:24
13 │ B { r: R{} } = *b;
│ ^^ reference content copied here

error: value of type `M::R` does not have the `copy` ability
┌─ tests/ability-check/typing/derefrence_reference.move:14:17
14 │ R{} = *&b.r;
│ ^^^ reference content copied here

error: value of type `M::R` does not have the `copy` ability
┌─ tests/ability-check/typing/derefrence_reference.move:15:21
15 │ R{} = *&mut b.r;
│ ^^^ reference content copied here
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@

Diagnostics:
error: local `r` of type `M::R` does not have the `copy` ability
┌─ tests/reference-safety/derefrence_reference.move:6:16
6 │ R {} = *r;
│ ^^ reference content copied here

error: local `b` of type `M::B` does not have the `copy` ability
┌─ tests/reference-safety/derefrence_reference.move:7:24
7 │ B { r: R{} } = *b;
│ ^^ reference content copied here

error: value of type `M::R` does not have the `copy` ability
┌─ tests/reference-safety/derefrence_reference.move:8:17
8 │ R{} = *&b.r;
│ ^^^ reference content copied here

error: local `r` of type `M::R` does not have the `copy` ability
┌─ tests/reference-safety/derefrence_reference.move:12:16
12 │ R {} = *r;
│ ^^ reference content copied here

error: local `b` of type `M::B` does not have the `copy` ability
┌─ tests/reference-safety/derefrence_reference.move:13:24
13 │ B { r: R{} } = *b;
│ ^^ reference content copied here

error: value of type `M::R` does not have the `copy` ability
┌─ tests/reference-safety/derefrence_reference.move:14:17
14 │ R{} = *&b.r;
│ ^^^ reference content copied here

error: value of type `M::R` does not have the `copy` ability
┌─ tests/reference-safety/derefrence_reference.move:15:21
15 │ R{} = *&mut b.r;
│ ^^^ reference content copied here
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@

Diagnostics:
error: local `r` of type `M::R` does not have the `copy` ability
┌─ tests/reference-safety/derefrence_reference.move:6:16
6 │ R {} = *r;
│ ^^ reference content copied here

error: local `b` of type `M::B` does not have the `copy` ability
┌─ tests/reference-safety/derefrence_reference.move:7:24
7 │ B { r: R{} } = *b;
│ ^^ reference content copied here

error: value of type `M::R` does not have the `copy` ability
┌─ tests/reference-safety/derefrence_reference.move:8:17
8 │ R{} = *&b.r;
│ ^^^ reference content copied here

error: local `r` of type `M::R` does not have the `copy` ability
┌─ tests/reference-safety/derefrence_reference.move:12:16
12 │ R {} = *r;
│ ^^ reference content copied here

error: local `b` of type `M::B` does not have the `copy` ability
┌─ tests/reference-safety/derefrence_reference.move:13:24
13 │ B { r: R{} } = *b;
│ ^^ reference content copied here

error: value of type `M::R` does not have the `copy` ability
┌─ tests/reference-safety/derefrence_reference.move:14:17
14 │ R{} = *&b.r;
│ ^^^ reference content copied here

error: value of type `M::R` does not have the `copy` ability
┌─ tests/reference-safety/derefrence_reference.move:15:21
15 │ R{} = *&mut b.r;
│ ^^^ reference content copied here
Original file line number Diff line number Diff line change
@@ -1,77 +1,77 @@

Diagnostics:
error: cannot use `u128` with an operator which expects a value of type `u8`
┌─ tests/checking/typing/eq_invalid.move:13:21
┌─ tests/ability-check/typing/eq_invalid.move:13:21
13 │ (0: u8) == (1: u128);
│ ^

error: cannot use `bool` with an operator which expects a value of type `integer`
┌─ tests/checking/typing/eq_invalid.move:14:14
┌─ tests/ability-check/typing/eq_invalid.move:14:14
14 │ 0 == false;
│ ^^^^^

error: reference type `&integer` is not allowed as a type argument (type was inferred)
┌─ tests/checking/typing/eq_invalid.move:15:12
┌─ tests/ability-check/typing/eq_invalid.move:15:12
15 │ &0 == 1;
│ ^^
= required by instantiating type parameter `T` of function `==`

error: cannot use `&integer` with an operator which expects a value of type `integer`
┌─ tests/checking/typing/eq_invalid.move:16:14
┌─ tests/ability-check/typing/eq_invalid.move:16:14
16 │ 1 == &0;
│ ^^

error: cannot use `&S` with an operator which expects a value of type `S`
┌─ tests/checking/typing/eq_invalid.move:17:14
┌─ tests/ability-check/typing/eq_invalid.move:17:14
17 │ s == s_ref;
│ ^^^^^

error: reference type `&mut S` is not allowed as a type argument (type was inferred)
┌─ tests/checking/typing/eq_invalid.move:18:15
┌─ tests/ability-check/typing/eq_invalid.move:18:15
18 │ s_mut == s;
│ ^^
= required by instantiating type parameter `T` of function `==`

error: unable to infer instantiation of type `G2<_>` (consider providing type arguments or annotating the type)
┌─ tests/checking/typing/eq_invalid.move:28:9
┌─ tests/ability-check/typing/eq_invalid.move:28:9
28 │ G2{} == G2{};
│ ^^^^

error: tuple type `()` is not allowed as a type argument (type was inferred)
┌─ tests/checking/typing/eq_invalid.move:33:12
┌─ tests/ability-check/typing/eq_invalid.move:33:12
33 │ () == ();
│ ^^
= required by instantiating type parameter `T` of function `==`

error: tuple type `(integer, integer)` is not allowed as a type argument (type was inferred)
┌─ tests/checking/typing/eq_invalid.move:34:16
┌─ tests/ability-check/typing/eq_invalid.move:34:16
34 │ (0, 1) == (0, 1);
│ ^^
= required by instantiating type parameter `T` of function `==`

error: tuple type `(integer, integer, integer)` is not allowed as a type argument (type was inferred)
┌─ tests/checking/typing/eq_invalid.move:35:19
┌─ tests/ability-check/typing/eq_invalid.move:35:19
35 │ (1, 2, 3) == (0, 1);
│ ^^
= required by instantiating type parameter `T` of function `==`

error: tuple type `(integer, integer)` is not allowed as a type argument (type was inferred)
┌─ tests/checking/typing/eq_invalid.move:36:16
┌─ tests/ability-check/typing/eq_invalid.move:36:16
36 │ (0, 1) == (1, 2, 3);
│ ^^
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

Diagnostics:
error: local `r` of type `M::R` does not have the `copy` ability
┌─ tests/ability-check/typing/eq_invalid2.move:11:9
11 │ r == r;
│ ^^^^^^ copy needed here because value is still in use

error: local `r` of type `M::R` does not have the `drop` ability
┌─ tests/ability-check/typing/eq_invalid2.move:11:9
11 │ r == r;
│ ^^^^^^ operator drops value here (consider borrowing the argument)

error: value of type `M::G1<T>` does not have the `drop` ability
┌─ tests/ability-check/typing/eq_invalid2.move:15:9
15 │ G1{ f: t } == G1{ f: t };
│ ^^^^^^^^^^^^^^^^^^^^^^^^ operator drops value here (consider borrowing the argument)
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module 0x8675309::M {
struct S { u: u64 }
struct R has key {
f: u64
}
struct G0<T> has drop { f: T }
struct G1<T: key> { f: T }
struct G2<phantom T> has drop {}

fun t1(r: R) {
r == r;
}

fun t3<T: copy + key>(t: T) {
G1{ f: t } == G1{ f: t };
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

============ bytecode verification succeeded ========
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Diagnostics:
error: unable to infer instantiation of type `S<_>` (consider providing type arguments or annotating the type)
┌─ tests/checking/typing/ignore_inferred_resource.move:4:9
┌─ tests/ability-check/typing/ignore_inferred_resource.move:4:9
4 │ S{};
│ ^^^
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

Diagnostics:
error: unable to infer instantiation of type `S<_>` (consider providing type arguments or annotating the type)
┌─ tests/ability-check/typing/ignore_inferred_resource2.move:4:9
4 │ S{};
│ ^^^
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module 0x8675309::M {
struct S<phantom T> has drop {}
fun no() {
S{};
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

============ bytecode verification succeeded ========
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module 0x8675309::M {
struct S<phantom T> has drop {}
fun no<T>() {
S<T>{};
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

============ bytecode verification succeeded ========
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module 0x8675309::M {
struct S<phantom T> has drop {}
fun no<T: drop>() {
S<T>{};
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

Diagnostics:
error: local `_x` of type `T` does not have the `drop` ability
┌─ tests/ability-check/typing/module_call_explicit_type_arguments.move:2:33
2 │ fun foo<T, U>(_x: T, _y: U) {
│ ╭─────────────────────────────────^
3 │ │ }
│ ╰─────^ implicitly dropped here since it is no longer used

error: local `_y` of type `U` does not have the `drop` ability
┌─ tests/ability-check/typing/module_call_explicit_type_arguments.move:2:33
2 │ fun foo<T, U>(_x: T, _y: U) {
│ ╭─────────────────────────────────^
3 │ │ }
│ ╰─────^ implicitly dropped here since it is no longer used
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

Diagnostics:
error: local `r` of type `M::R` does not have the `drop` ability
┌─ tests/ability-check/typing/mutate_resource.move:5:9
5 │ *r = R {};
│ ^^^^^^^^^ reference content dropped here

error: local `r` of type `T` does not have the `drop` ability
┌─ tests/ability-check/typing/mutate_resource.move:9:9
9 │ *r = x;
│ ^^^^^^ reference content dropped here

error: local `r` of type `T` does not have the `drop` ability
┌─ tests/ability-check/typing/mutate_resource.move:13:9
13 │ *r = x;
│ ^^^^^^ reference content dropped here
Loading

0 comments on commit 2b208e5

Please sign in to comment.