diff --git a/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_constant_duplicated_struct.exp b/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_constant_duplicated_struct.exp new file mode 100644 index 0000000000000..c137632b65437 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_constant_duplicated_struct.exp @@ -0,0 +1,27 @@ + +Diagnostics: +error: duplicate declaration, item, or annotation + ┌─ tests/more-v1/deprecated/deprecated_constant_duplicated_struct.move:5:11 + │ +4 │ struct C { } + │ - Alias previously defined here +5 │ const C: u64 = 0; + │ ^ Duplicate module member or alias 'C'. Top level names in a namespace must be unique + +warning: unused alias + ┌─ tests/more-v1/deprecated/deprecated_constant_duplicated_struct.move:12:15 + │ +12 │ use 0x42::mod1; + │ ^^^^ Unused 'use' of alias 'mod1'. Consider removing it + +warning: unused alias + ┌─ tests/more-v1/deprecated/deprecated_constant_duplicated_struct.move:31:15 + │ +31 │ use 0x42::mod1; + │ ^^^^ Unused 'use' of alias 'mod1'. Consider removing it + +error: invalid name + ┌─ tests/more-v1/deprecated/deprecated_constant_duplicated_struct.move:32:26 + │ +32 │ use 0x42::mod1::C as mod1; + │ ^^^^ Invalid constant alias name 'mod1'. Constant alias names must start with 'A'..'Z' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_constant_duplicated_struct.move b/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_constant_duplicated_struct.move new file mode 100644 index 0000000000000..e700dd74e7aec --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_constant_duplicated_struct.move @@ -0,0 +1,44 @@ +address 0x42 { +module mod1 { + #[deprecated] + struct C { } + const C: u64 = 0; + public fun mod1() {} +} +} + +address 0x41 { +module N { + use 0x42::mod1; + use 0x42::mod1::C as D; + use 0x42::mod1::C as C; + use 0x42::mod1::mod1; + + fun f1(): 0x42::mod1::C { + mod1(); + C; + { + use 0x42::mod1::C; + C + }; + D + } +} +} + + +script { + use 0x42::mod1; + use 0x42::mod1::C as mod1; + use 0x42::mod1::C as C; + use 0x42::mod1::mod1; + + fun f1(): 0x42::mod1::C { + mod1(); + C; + { + use 0x42::mod1::C; + C + } + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_constant_duplicated_struct2.exp b/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_constant_duplicated_struct2.exp new file mode 100644 index 0000000000000..29d61842638ca --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_constant_duplicated_struct2.exp @@ -0,0 +1,145 @@ + +Diagnostics: +error: duplicate declaration, item, or annotation + ┌─ tests/more-v1/deprecated/deprecated_constant_duplicated_struct2.move:5:11 + │ +3 │ struct C { } + │ - Alias previously defined here +4 │ #[deprecated] +5 │ const C: u64 = 0; + │ ^ Duplicate module member or alias 'C'. Top level names in a namespace must be unique + +warning: unused alias + ┌─ tests/more-v1/deprecated/deprecated_constant_duplicated_struct2.move:12:15 + │ +12 │ use 0x42::mod1; + │ ^^^^ Unused 'use' of alias 'mod1'. Consider removing it + +warning: Use of deprecated constant + ┌─ tests/more-v1/deprecated/deprecated_constant_duplicated_struct2.move:13:21 + │ + 4 │ #[deprecated] + │ ---------- Constant 'C' in module '0x42::mod1' deprecated here + · +13 │ use 0x42::mod1::C as D; + │ ^ Use of deprecated constant 'C' from module '0x42::mod1' + +warning: Use of deprecated constant + ┌─ tests/more-v1/deprecated/deprecated_constant_duplicated_struct2.move:14:21 + │ + 4 │ #[deprecated] + │ ---------- Constant 'C' in module '0x42::mod1' deprecated here + · +14 │ use 0x42::mod1::C as C; + │ ^ Use of deprecated constant 'C' from module '0x42::mod1' + +warning: Use of deprecated struct + ┌─ tests/more-v1/deprecated/deprecated_constant_duplicated_struct2.move:17:27 + │ + 4 │ #[deprecated] + │ ---------- Struct 'C' in module '0x42::mod1' deprecated here + · +17 │ fun f1(): 0x42::mod1::C { + │ ^ Use of deprecated struct 'C' from module '0x42::mod1' + +warning: Use of deprecated member + ┌─ tests/more-v1/deprecated/deprecated_constant_duplicated_struct2.move:19:2 + │ + 4 │ #[deprecated] + │ ---------- Member 'C' in module '0x42::mod1' deprecated here + · +19 │ C; + │ ^ Use of deprecated member 'C' from module '0x42::mod1' + +warning: Use of deprecated constant + ┌─ tests/more-v1/deprecated/deprecated_constant_duplicated_struct2.move:21:22 + │ + 4 │ #[deprecated] + │ ---------- Constant 'C' in module '0x42::mod1' deprecated here + · +21 │ use 0x42::mod1::C; + │ ^ Use of deprecated constant 'C' from module '0x42::mod1' + +warning: Use of deprecated member + ┌─ tests/more-v1/deprecated/deprecated_constant_duplicated_struct2.move:22:6 + │ + 4 │ #[deprecated] + │ ---------- Member 'C' in module '0x42::mod1' deprecated here + · +22 │ C + │ ^ Use of deprecated member 'C' from module '0x42::mod1' + +warning: Use of deprecated member + ┌─ tests/more-v1/deprecated/deprecated_constant_duplicated_struct2.move:24:2 + │ + 4 │ #[deprecated] + │ ---------- Member 'C' in module '0x42::mod1' deprecated here + · +24 │ D + │ ^ Use of deprecated member 'C' from module '0x42::mod1' + +warning: unused alias + ┌─ tests/more-v1/deprecated/deprecated_constant_duplicated_struct2.move:31:15 + │ +31 │ use 0x42::mod1; + │ ^^^^ Unused 'use' of alias 'mod1'. Consider removing it + +warning: Use of deprecated constant + ┌─ tests/more-v1/deprecated/deprecated_constant_duplicated_struct2.move:32:21 + │ + 4 │ #[deprecated] + │ ---------- Constant 'C' in module '0x42::mod1' deprecated here + · +32 │ use 0x42::mod1::C as mod1; + │ ^ Use of deprecated constant 'C' from module '0x42::mod1' + +error: invalid name + ┌─ tests/more-v1/deprecated/deprecated_constant_duplicated_struct2.move:32:26 + │ +32 │ use 0x42::mod1::C as mod1; + │ ^^^^ Invalid constant alias name 'mod1'. Constant alias names must start with 'A'..'Z' + +warning: Use of deprecated constant + ┌─ tests/more-v1/deprecated/deprecated_constant_duplicated_struct2.move:33:21 + │ + 4 │ #[deprecated] + │ ---------- Constant 'C' in module '0x42::mod1' deprecated here + · +33 │ use 0x42::mod1::C as C; + │ ^ Use of deprecated constant 'C' from module '0x42::mod1' + +warning: Use of deprecated struct + ┌─ tests/more-v1/deprecated/deprecated_constant_duplicated_struct2.move:36:27 + │ + 4 │ #[deprecated] + │ ---------- Struct 'C' in module '0x42::mod1' deprecated here + · +36 │ fun f1(): 0x42::mod1::C { + │ ^ Use of deprecated struct 'C' from module '0x42::mod1' + +warning: Use of deprecated member + ┌─ tests/more-v1/deprecated/deprecated_constant_duplicated_struct2.move:38:2 + │ + 4 │ #[deprecated] + │ ---------- Member 'C' in module '0x42::mod1' deprecated here + · +38 │ C; + │ ^ Use of deprecated member 'C' from module '0x42::mod1' + +warning: Use of deprecated constant + ┌─ tests/more-v1/deprecated/deprecated_constant_duplicated_struct2.move:40:22 + │ + 4 │ #[deprecated] + │ ---------- Constant 'C' in module '0x42::mod1' deprecated here + · +40 │ use 0x42::mod1::C; + │ ^ Use of deprecated constant 'C' from module '0x42::mod1' + +warning: Use of deprecated member + ┌─ tests/more-v1/deprecated/deprecated_constant_duplicated_struct2.move:41:6 + │ + 4 │ #[deprecated] + │ ---------- Member 'C' in module '0x42::mod1' deprecated here + · +41 │ C + │ ^ Use of deprecated member 'C' from module '0x42::mod1' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_constant_duplicated_struct2.move b/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_constant_duplicated_struct2.move new file mode 100644 index 0000000000000..faf1c9ff4b518 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_constant_duplicated_struct2.move @@ -0,0 +1,44 @@ +address 0x42 { +module mod1 { + struct C { } + #[deprecated] + const C: u64 = 0; + public fun mod1() {} +} +} + +address 0x41 { +module N { + use 0x42::mod1; + use 0x42::mod1::C as D; + use 0x42::mod1::C as C; + use 0x42::mod1::mod1; + + fun f1(): 0x42::mod1::C { + mod1(); + C; + { + use 0x42::mod1::C; + C + }; + D + } +} +} + + +script { + use 0x42::mod1; + use 0x42::mod1::C as mod1; + use 0x42::mod1::C as C; + use 0x42::mod1::mod1; + + fun f1(): 0x42::mod1::C { + mod1(); + C; + { + use 0x42::mod1::C; + C + } + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_field_type.exp b/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_field_type.exp new file mode 100644 index 0000000000000..232d6a4e19b9f --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_field_type.exp @@ -0,0 +1,31 @@ + +Diagnostics: +warning: Use of deprecated struct + ┌─ tests/more-v1/deprecated/deprecated_field_type.move:17:22 + │ + 3 │ #[deprecated] + │ ---------- Struct 'EventHandle' in module '0x42::event' deprecated here + · +17 │ use 0x42::event::EventHandle; + │ ^^^^^^^^^^^ Use of deprecated struct 'EventHandle' from module '0x42::event' + +warning: Use of deprecated struct + ┌─ tests/more-v1/deprecated/deprecated_field_type.move:27:25 + │ + 3 │ #[deprecated] + │ ---------- Struct 'EventHandle' in module '0x42::event' deprecated here + · +27 │ deposit_events: EventHandle, + │ ^^^^^^^^^^^ Use of deprecated struct 'EventHandle' from module '0x42::event' + +warning: Use of deprecated struct + ┌─ tests/more-v1/deprecated/deprecated_field_type.move:28:26 + │ + 3 │ #[deprecated] + │ ---------- Struct 'EventHandle' in module '0x42::event' deprecated here + · +28 │ withdraw_events: EventHandle, + │ ^^^^^^^^^^^ Use of deprecated struct 'EventHandle' from module '0x42::event' + + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_field_type.move b/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_field_type.move new file mode 100644 index 0000000000000..7b8603579e617 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_field_type.move @@ -0,0 +1,30 @@ +module 0x42::event { + + #[deprecated] + /// A handle for an event such that: + /// 1. Other modules can emit events to this handle. + /// 2. Storage can use this handle to prove the total number of events that happened in the past. + struct EventHandle has store { + /// Total number of events emitted to this event stream. + counter: u64, + /// A globally unique ID for this event stream. + guid: u64, + } + +} + +module 0x41::coin { + use 0x42::event::EventHandle; + + struct Coin has store { } + struct CoinType has key {} + struct DepositEvent has drop, store {} + struct WithdrawEvent has drop, store {} + + struct CoinStore has key { + coin: Coin, + frozen: bool, + deposit_events: EventHandle, + withdraw_events: EventHandle, + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_field_type2.exp b/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_field_type2.exp new file mode 100644 index 0000000000000..c5c33e8394476 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_field_type2.exp @@ -0,0 +1,13 @@ + +Diagnostics: +warning: Use of deprecated struct + ┌─ tests/more-v1/deprecated/deprecated_field_type2.move:29:38 + │ +22 │ #[deprecated] + │ ---------- Struct 'WithdrawEvent' in module '0x41::coin' deprecated here + · +29 │ withdraw_events: EventHandle, + │ ^^^^^^^^^^^^^ Use of deprecated struct 'WithdrawEvent' from module '0x41::coin' + + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_field_type2.move b/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_field_type2.move new file mode 100644 index 0000000000000..f21a61fedec9a --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_field_type2.move @@ -0,0 +1,31 @@ +module 0x42::event { + + /// A handle for an event such that: + /// 1. Other modules can emit events to this handle. + /// 2. Storage can use this handle to prove the total number of events that happened in the past. + struct EventHandle has store { + /// Total number of events emitted to this event stream. + counter: u64, + /// A globally unique ID for this event stream. + guid: u64, + } + +} + +module 0x41::coin { + use 0x42::event::EventHandle; + + struct Coin has store { } + struct CoinType has key {} + struct DepositEvent has drop, store {} + + #[deprecated] + struct WithdrawEvent has drop, store {} + + struct CoinStore has key { + coin: Coin, + frozen: bool, + deposit_events: EventHandle, + withdraw_events: EventHandle, + } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_address.exp b/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_address.exp new file mode 100644 index 0000000000000..d0f2fd0c21140 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_address.exp @@ -0,0 +1,22 @@ + +Diagnostics: +warning: Use of deprecated module + ┌─ tests/more-v1/deprecated/deprecated_placement_address.move:25:9 + │ + 1 │ #[deprecated] + │ ---------- Module '0x42::M' deprecated here + · +25 │ use 0x42::M; + │ ^^^^^^^ Use of deprecated module '0x42::M' + +warning: Use of deprecated module + ┌─ tests/more-v1/deprecated/deprecated_placement_address.move:29:15 + │ + 1 │ #[deprecated] + │ ---------- Module '0x42::M' deprecated here + · +29 │ let foo: S = M::foo(); + │ ^ Use of deprecated module '0x42::M' + + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_address.move b/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_address.move new file mode 100644 index 0000000000000..368cb7469e473 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_address.move @@ -0,0 +1,34 @@ +#[deprecated] +address 0x42 { +module M { + use 0x41::N; + + struct S {} + + const C: u64 = 0; + + public fun foo(): N::S { let _foo = C + 3; N::bar() } + + spec foo {} +} +} + +module 0x41::N { + struct S has drop { } + + public fun bar(): S { S { } } + + public fun consume(_x: S) { } +} + +script { + use 0x42::M; + use 0x41::N::S; + + fun main() { + let foo: S = M::foo(); + 0x41::N::consume(foo); + } + + spec main { } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_address_module_members.exp b/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_address_module_members.exp new file mode 100644 index 0000000000000..d96feb00d6582 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_address_module_members.exp @@ -0,0 +1,76 @@ + +Diagnostics: +warning: Use of deprecated module + ┌─ tests/more-v1/deprecated/deprecated_placement_address_module_members.move:33:9 + │ + 1 │ #[deprecated] // Think about using 0x43 instead + │ ---------- Module '0x42::M' deprecated here + · +33 │ use 0x42::M; + │ ^^^^^^^ Use of deprecated module '0x42::M' + +warning: Use of deprecated module + ┌─ tests/more-v1/deprecated/deprecated_placement_address_module_members.move:34:9 + │ +20 │ #[deprecated] + │ ---------- Module '0x41::N' deprecated here + · +34 │ use 0x41::N::S; + │ ^^^^^^^ Use of deprecated module '0x41::N' + +warning: Use of deprecated struct + ┌─ tests/more-v1/deprecated/deprecated_placement_address_module_members.move:34:18 + │ +22 │ #[deprecated] + │ ---------- Struct 'S' in module '0x41::N' deprecated here + · +34 │ use 0x41::N::S; + │ ^ Use of deprecated struct 'S' from module '0x41::N' + +warning: Use of deprecated struct + ┌─ tests/more-v1/deprecated/deprecated_placement_address_module_members.move:37:11 + │ +22 │ #[deprecated] + │ ---------- Struct 'S' in module '0x41::N' deprecated here + · +37 │ let foo: S = M::foo(); + │ ^ Use of deprecated struct 'S' from module '0x41::N' + +warning: Use of deprecated module + ┌─ tests/more-v1/deprecated/deprecated_placement_address_module_members.move:37:15 + │ + 1 │ #[deprecated] // Think about using 0x43 instead + │ ---------- Module '0x42::M' deprecated here + · +37 │ let foo: S = M::foo(); + │ ^ Use of deprecated module '0x42::M' + +warning: Use of deprecated function + ┌─ tests/more-v1/deprecated/deprecated_placement_address_module_members.move:37:18 + │ +13 │ #[deprecated] + │ ---------- Function 'foo' in module '0x42::M' deprecated here + · +37 │ let foo: S = M::foo(); + │ ^^^ Use of deprecated function 'foo' from module '0x42::M' + +warning: Use of deprecated module + ┌─ tests/more-v1/deprecated/deprecated_placement_address_module_members.move:38:2 + │ +20 │ #[deprecated] + │ ---------- Module '0x41::N' deprecated here + · +38 │ 0x41::N::consume(foo); + │ ^^^^^^^ Use of deprecated module '0x41::N' + +warning: Use of deprecated function + ┌─ tests/more-v1/deprecated/deprecated_placement_address_module_members.move:38:11 + │ +28 │ #[deprecated] + │ ---------- Function 'consume' in module '0x41::N' deprecated here + · +38 │ 0x41::N::consume(foo); + │ ^^^^^^^ Use of deprecated function 'consume' from module '0x41::N' + + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_address_module_members.move b/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_address_module_members.move new file mode 100644 index 0000000000000..361ac55d38042 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_address_module_members.move @@ -0,0 +1,42 @@ +#[deprecated] // Think about using 0x43 instead +address 0x42 { +#[deprecated] // Try module M2 +module M { + use 0x41::N; + + #[deprecated] + struct S {} + + #[deprecated] + const C: u64 = 0; + + #[deprecated] + public fun foo(): N::S { let _foo = C + 3; N::bar() } + + spec foo {} +} +} + +#[deprecated] +module 0x41::N { + #[deprecated] + struct S has drop { } + + #[deprecated] + public fun bar(): S { S { } } + + #[deprecated] + public fun consume(_x: S) { } +} + +script { + use 0x42::M; + use 0x41::N::S; + + fun main() { + let foo: S = M::foo(); + 0x41::N::consume(foo); + } + + spec main { } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_members.exp b/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_members.exp new file mode 100644 index 0000000000000..ab4325eeea366 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_members.exp @@ -0,0 +1,40 @@ + +Diagnostics: +warning: Use of deprecated struct + ┌─ tests/more-v1/deprecated/deprecated_placement_members.move:31:18 + │ +19 │ #[deprecated] + │ ---------- Struct 'S' in module '0x41::N' deprecated here + · +31 │ use 0x41::N::S; + │ ^ Use of deprecated struct 'S' from module '0x41::N' + +warning: Use of deprecated struct + ┌─ tests/more-v1/deprecated/deprecated_placement_members.move:34:11 + │ +19 │ #[deprecated] + │ ---------- Struct 'S' in module '0x41::N' deprecated here + · +34 │ let foo: S = M::foo(); + │ ^ Use of deprecated struct 'S' from module '0x41::N' + +warning: Use of deprecated function + ┌─ tests/more-v1/deprecated/deprecated_placement_members.move:34:18 + │ +11 │ #[deprecated] + │ ---------- Function 'foo' in module '0x42::M' deprecated here + · +34 │ let foo: S = M::foo(); + │ ^^^ Use of deprecated function 'foo' from module '0x42::M' + +warning: Use of deprecated function + ┌─ tests/more-v1/deprecated/deprecated_placement_members.move:35:11 + │ +25 │ #[deprecated] + │ ---------- Function 'consume' in module '0x41::N' deprecated here + · +35 │ 0x41::N::consume(foo); + │ ^^^^^^^ Use of deprecated function 'consume' from module '0x41::N' + + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_members.move b/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_members.move new file mode 100644 index 0000000000000..c05b48447a29a --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_members.move @@ -0,0 +1,39 @@ +address 0x42 { +module M { + use 0x41::N; + + #[deprecated] + struct S {} + + #[deprecated] + const C: u64 = 0; + + #[deprecated] + public fun foo(): N::S { let _foo = C + 3; N::bar() } + + spec foo {} +} +} + +module 0x41::N { + #[deprecated] + struct S has drop { } + + #[deprecated] + public fun bar(): S { S { } } + + #[deprecated] + public fun consume(_x: S) { } +} + +script { + use 0x42::M; + use 0x41::N::S; + + fun main() { + let foo: S = M::foo(); + 0x41::N::consume(foo); + } + + spec main { } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_module.exp b/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_module.exp new file mode 100644 index 0000000000000..acf06508493dc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_module.exp @@ -0,0 +1,22 @@ + +Diagnostics: +warning: Use of deprecated module + ┌─ tests/more-v1/deprecated/deprecated_placement_module.move:25:9 + │ + 2 │ #[deprecated] + │ ---------- Module '0x42::M' deprecated here + · +25 │ use 0x42::M; + │ ^^^^^^^ Use of deprecated module '0x42::M' + +warning: Use of deprecated module + ┌─ tests/more-v1/deprecated/deprecated_placement_module.move:29:15 + │ + 2 │ #[deprecated] + │ ---------- Module '0x42::M' deprecated here + · +29 │ let foo: S = M::foo(); + │ ^ Use of deprecated module '0x42::M' + + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_module.move b/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_module.move new file mode 100644 index 0000000000000..7f2041ed6215a --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_module.move @@ -0,0 +1,34 @@ +address 0x42 { +#[deprecated] +module M { + use 0x41::N; + + struct S {} + + const C: u64 = 0; + + public fun foo(): N::S { let _foo = C + 3; N::bar() } + + spec foo {} +} +} + +module 0x41::N { + struct S has drop { } + + public fun bar(): S { S { } } + + public fun consume(_x: S) { } +} + +script { + use 0x42::M; + use 0x41::N::S; + + fun main() { + let foo: S = M::foo(); + 0x41::N::consume(foo); + } + + spec main { } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_module2.exp b/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_module2.exp new file mode 100644 index 0000000000000..a7f6d2a94dfb0 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_module2.exp @@ -0,0 +1,49 @@ + +Diagnostics: +warning: Use of deprecated module + ┌─ tests/more-v1/deprecated/deprecated_placement_module2.move:3:9 + │ + 3 │ use 0x41::N; + │ ^^^^^^^ Use of deprecated module '0x41::N' + · +15 │ #[deprecated] + │ ---------- Module '0x41::N' deprecated here + +warning: Use of deprecated module + ┌─ tests/more-v1/deprecated/deprecated_placement_module2.move:9:23 + │ + 9 │ public fun foo(): N::S { let _foo = C + 3; N::bar() } + │ ^ Use of deprecated module '0x41::N' + · +15 │ #[deprecated] + │ ---------- Module '0x41::N' deprecated here + +warning: Use of deprecated module + ┌─ tests/more-v1/deprecated/deprecated_placement_module2.move:9:48 + │ + 9 │ public fun foo(): N::S { let _foo = C + 3; N::bar() } + │ ^ Use of deprecated module '0x41::N' + · +15 │ #[deprecated] + │ ---------- Module '0x41::N' deprecated here + +warning: Use of deprecated module + ┌─ tests/more-v1/deprecated/deprecated_placement_module2.move:26:9 + │ +15 │ #[deprecated] + │ ---------- Module '0x41::N' deprecated here + · +26 │ use 0x41::N::S; + │ ^^^^^^^ Use of deprecated module '0x41::N' + +warning: Use of deprecated module + ┌─ tests/more-v1/deprecated/deprecated_placement_module2.move:30:2 + │ +15 │ #[deprecated] + │ ---------- Module '0x41::N' deprecated here + · +30 │ 0x41::N::consume(foo); + │ ^^^^^^^ Use of deprecated module '0x41::N' + + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_module2.move b/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_module2.move new file mode 100644 index 0000000000000..a1a98631b86d8 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_module2.move @@ -0,0 +1,34 @@ +address 0x42 { +module M { + use 0x41::N; + + struct S {} + + const C: u64 = 0; + + public fun foo(): N::S { let _foo = C + 3; N::bar() } + + spec foo {} +} +} + +#[deprecated] +module 0x41::N { + struct S has drop { } + + public fun bar(): S { S { } } + + public fun consume(_x: S) { } +} + +script { + use 0x42::M; + use 0x41::N::S; + + fun main() { + let foo: S = M::foo(); + 0x41::N::consume(foo); + } + + spec main { } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_module_members.exp b/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_module_members.exp new file mode 100644 index 0000000000000..2cb940362c35f --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_module_members.exp @@ -0,0 +1,76 @@ + +Diagnostics: +warning: Use of deprecated module + ┌─ tests/more-v1/deprecated/deprecated_placement_module_members.move:32:9 + │ + 2 │ #[deprecated] + │ ---------- Module '0x42::M' deprecated here + · +32 │ use 0x42::M; + │ ^^^^^^^ Use of deprecated module '0x42::M' + +warning: Use of deprecated module + ┌─ tests/more-v1/deprecated/deprecated_placement_module_members.move:33:9 + │ +19 │ #[deprecated] + │ ---------- Module '0x41::N' deprecated here + · +33 │ use 0x41::N::S; + │ ^^^^^^^ Use of deprecated module '0x41::N' + +warning: Use of deprecated struct + ┌─ tests/more-v1/deprecated/deprecated_placement_module_members.move:33:18 + │ +21 │ #[deprecated] + │ ---------- Struct 'S' in module '0x41::N' deprecated here + · +33 │ use 0x41::N::S; + │ ^ Use of deprecated struct 'S' from module '0x41::N' + +warning: Use of deprecated struct + ┌─ tests/more-v1/deprecated/deprecated_placement_module_members.move:36:11 + │ +21 │ #[deprecated] + │ ---------- Struct 'S' in module '0x41::N' deprecated here + · +36 │ let foo: S = M::foo(); + │ ^ Use of deprecated struct 'S' from module '0x41::N' + +warning: Use of deprecated module + ┌─ tests/more-v1/deprecated/deprecated_placement_module_members.move:36:15 + │ + 2 │ #[deprecated] + │ ---------- Module '0x42::M' deprecated here + · +36 │ let foo: S = M::foo(); + │ ^ Use of deprecated module '0x42::M' + +warning: Use of deprecated function + ┌─ tests/more-v1/deprecated/deprecated_placement_module_members.move:36:18 + │ +12 │ #[deprecated] + │ ---------- Function 'foo' in module '0x42::M' deprecated here + · +36 │ let foo: S = M::foo(); + │ ^^^ Use of deprecated function 'foo' from module '0x42::M' + +warning: Use of deprecated module + ┌─ tests/more-v1/deprecated/deprecated_placement_module_members.move:37:2 + │ +19 │ #[deprecated] + │ ---------- Module '0x41::N' deprecated here + · +37 │ 0x41::N::consume(foo); + │ ^^^^^^^ Use of deprecated module '0x41::N' + +warning: Use of deprecated function + ┌─ tests/more-v1/deprecated/deprecated_placement_module_members.move:37:11 + │ +27 │ #[deprecated] + │ ---------- Function 'consume' in module '0x41::N' deprecated here + · +37 │ 0x41::N::consume(foo); + │ ^^^^^^^ Use of deprecated function 'consume' from module '0x41::N' + + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_module_members.move b/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_module_members.move new file mode 100644 index 0000000000000..e3b71a074b341 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_module_members.move @@ -0,0 +1,41 @@ +address 0x42 { +#[deprecated] +module M { + use 0x41::N; + + #[deprecated] + struct S {} + + #[deprecated] + const C: u64 = 0; + + #[deprecated] + public fun foo(): N::S { let _foo = C + 3; N::bar() } + + spec foo {} +} +} + +#[deprecated] +module 0x41::N { + #[deprecated] + struct S has drop { } + + #[deprecated] + public fun bar(): S { S { } } + + #[deprecated] + public fun consume(_x: S) { } +} + +script { + use 0x42::M; + use 0x41::N::S; + + fun main() { + let foo: S = M::foo(); + 0x41::N::consume(foo); + } + + spec main { } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/deprecated/public_script.exp b/third_party/move/move-compiler-v2/tests/more-v1/deprecated/public_script.exp new file mode 100644 index 0000000000000..511ecff116506 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/deprecated/public_script.exp @@ -0,0 +1,13 @@ + +Diagnostics: +warning: DEPRECATED. will be removed + ┌─ tests/more-v1/deprecated/public_script.move:2:5 + │ +2 │ public(script) fun main() { + │ ^^^^^^^^^^^^^^ 'public(script)' is deprecated in favor of the 'entry' modifier. Replace with 'public entry' + +error: address with no value + ┌─ tests/more-v1/deprecated/public_script.move:4:30 + │ +4 │ let _addr:address = @Test; + │ ^^^^ address 'Test' is not assigned a value. Try assigning it a value when calling the compiler diff --git a/third_party/move/move-compiler-v2/tests/more-v1/deprecated/public_script.move b/third_party/move/move-compiler-v2/tests/more-v1/deprecated/public_script.move new file mode 100644 index 0000000000000..d225e0f525526 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/deprecated/public_script.move @@ -0,0 +1,6 @@ +module 0x1::Test { + public(script) fun main() { + // Previously, deprecation plus an error led to a compiler assert. Make sure that doesn't come back. + let _addr:address = @Test; + } +} diff --git a/third_party/move/move-compiler-v2/tests/v1.matched b/third_party/move/move-compiler-v2/tests/v1.matched index 52ce845e8ef28..e87e20aebc489 100644 --- a/third_party/move/move-compiler-v2/tests/v1.matched +++ b/third_party/move/move-compiler-v2/tests/v1.matched @@ -154,6 +154,17 @@ move-compiler/tests/move_check/translated_ir_tests/move/commands/use_before_assi move-compiler/tests/move_check/control_flow/for_loop_empty_novar.exp move-compiler-v2/tests/checking/control_flow/for_loop_empty_novar.exp move-compiler/tests/move_check/control_flow/for_type_mismatch.exp move-compiler-v2/tests/checking/control_flow/for_type_mismatch.exp move-compiler/tests/move_check/control_flow/loop_after_loop.exp move-compiler-v2/tests/checking/control_flow/loop_after_loop.exp +move-compiler/tests/move_check/deprecated/deprecated_constant_duplicated_struct.exp move-compiler-v2/tests/more-v1/deprecated/deprecated_constant_duplicated_struct.exp +move-compiler/tests/move_check/deprecated/deprecated_constant_duplicated_struct2.exp move-compiler-v2/tests/more-v1/deprecated/deprecated_constant_duplicated_struct2.exp +move-compiler/tests/move_check/deprecated/deprecated_field_type.exp move-compiler-v2/tests/more-v1/deprecated/deprecated_field_type.exp +move-compiler/tests/move_check/deprecated/deprecated_field_type2.exp move-compiler-v2/tests/more-v1/deprecated/deprecated_field_type2.exp +move-compiler/tests/move_check/deprecated/deprecated_placement_address.exp move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_address.exp +move-compiler/tests/move_check/deprecated/deprecated_placement_address_module_members.exp move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_address_module_members.exp +move-compiler/tests/move_check/deprecated/deprecated_placement_members.exp move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_members.exp +move-compiler/tests/move_check/deprecated/deprecated_placement_module.exp move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_module.exp +move-compiler/tests/move_check/deprecated/deprecated_placement_module2.exp move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_module2.exp +move-compiler/tests/move_check/deprecated/deprecated_placement_module_members.exp move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_module_members.exp +move-compiler/tests/move_check/deprecated/public_script.exp move-compiler-v2/tests/more-v1/deprecated/public_script.exp move-compiler/tests/move_check/folding/empty_vectors.exp move-compiler-v2/tests/folding/empty_vectors.exp move-compiler/tests/move_check/folding/empty_vectors2.exp move-compiler-v2/tests/folding/empty_vectors2.exp move-compiler/tests/move_check/folding/non_constant_empty_vec.exp move-compiler-v2/tests/folding/non_constant_empty_vec.exp diff --git a/third_party/move/move-compiler-v2/tests/v1.unmatched b/third_party/move/move-compiler-v2/tests/v1.unmatched index cdcdb8dcda950..c37d46858cc26 100644 --- a/third_party/move/move-compiler-v2/tests/v1.unmatched +++ b/third_party/move/move-compiler-v2/tests/v1.unmatched @@ -35,18 +35,7 @@ move-compiler/tests/move_check/control_flow/{ } move-compiler/tests/move_check/deprecated/{ assert_function.move, - deprecated_constant_duplicated_struct.move, - deprecated_constant_duplicated_struct2.move, - deprecated_field_type.move, - deprecated_field_type2.move, - deprecated_placement_address.move, - deprecated_placement_address_module_members.move, deprecated_placement_basecase.move, - deprecated_placement_members.move, - deprecated_placement_module.move, - deprecated_placement_module2.move, - deprecated_placement_module_members.move, - public_script.move, } move-compiler/tests/move_check/examples/{ multi_pool_money_market_token.move,