diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/recursive_constant.exp b/third_party/move/move-compiler-v2/tests/checking/typing/recursive_constant.exp new file mode 100644 index 00000000000000..15c7a926284f45 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/checking/typing/recursive_constant.exp @@ -0,0 +1,9 @@ +// -- Model dump before bytecode pipeline +module 0x42::M { + public fun get_x(): u64 { + false + } + public fun get_y(): u64 { + false + } +} // end 0x42::M diff --git a/third_party/move/move-compiler-v2/tests/checking/typing/recursive_constant.move b/third_party/move/move-compiler-v2/tests/checking/typing/recursive_constant.move new file mode 100644 index 00000000000000..bf342fcfa62826 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/checking/typing/recursive_constant.move @@ -0,0 +1,15 @@ +address 0x42 { +module M { + const X: u64 = Y; + const Y: u64 = X; + const Z: u64 = 0; + + public fun get_x(): u64 { + X + } + + public fun get_y(): u64 { + Y + } +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_nested_self_as_invalid2.exp b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_nested_self_as_invalid2.exp new file mode 100644 index 00000000000000..1c31a70df07081 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_nested_self_as_invalid2.exp @@ -0,0 +1,13 @@ + +Diagnostics: +warning: unused alias + ┌─ tests/more-v1/expansion/use_nested_self_as_invalid2.move:8:26 + │ +8 │ use 0x2::X::{Self as B, foo, S}; + │ ^ Unused 'use' of alias 'B'. Consider removing it + +error: variants not allowed in this context + ┌─ tests/more-v1/expansion/use_nested_self_as_invalid2.move:10:19 + │ +10 │ struct X { f: X::S, f2: S } + │ ^^^^ diff --git a/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_nested_self_as_invalid2.move b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_nested_self_as_invalid2.move new file mode 100644 index 00000000000000..58bb11f6ca5c1a --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/expansion/use_nested_self_as_invalid2.move @@ -0,0 +1,16 @@ +address 0x2 { +module X { + struct S {} + public fun foo() {} +} + +module M { + use 0x2::X::{Self as B, foo, S}; + + struct X { f: X::S, f2: S } + fun bar() { + // X::foo(); + foo() + } +} +} diff --git a/third_party/move/move-compiler/tests/move_check/expansion/use_nested_self_as_invalid2.exp b/third_party/move/move-compiler/tests/move_check/expansion/use_nested_self_as_invalid2.exp new file mode 100644 index 00000000000000..92ffcfe4fc6967 --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/expansion/use_nested_self_as_invalid2.exp @@ -0,0 +1,12 @@ +warning[W09001]: unused alias + ┌─ tests/move_check/expansion/use_nested_self_as_invalid2.move:8:26 + │ +8 │ use 0x2::X::{Self as B, foo, S}; + │ ^ Unused 'use' of alias 'B'. Consider removing it + +error[E03002]: unbound module + ┌─ tests/move_check/expansion/use_nested_self_as_invalid2.move:10:19 + │ +10 │ struct X { f: X::S, f2: S } + │ ^ Unbound module or type alias 'X' + diff --git a/third_party/move/move-compiler/tests/move_check/expansion/use_nested_self_as_invalid2.move b/third_party/move/move-compiler/tests/move_check/expansion/use_nested_self_as_invalid2.move new file mode 100644 index 00000000000000..58bb11f6ca5c1a --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/expansion/use_nested_self_as_invalid2.move @@ -0,0 +1,16 @@ +address 0x2 { +module X { + struct S {} + public fun foo() {} +} + +module M { + use 0x2::X::{Self as B, foo, S}; + + struct X { f: X::S, f2: S } + fun bar() { + // X::foo(); + foo() + } +} +} diff --git a/third_party/move/move-compiler/tests/move_check/typing/recursive_constant.exp b/third_party/move/move-compiler/tests/move_check/typing/recursive_constant.exp new file mode 100644 index 00000000000000..058f17f7e76d17 --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/typing/recursive_constant.exp @@ -0,0 +1,12 @@ +error[E04013]: invalid statement or expression in constant + ┌─ tests/move_check/typing/recursive_constant.move:3:20 + │ +3 │ const X: u64 = Y; + │ ^ Other constants are not supported in constants + +error[E04013]: invalid statement or expression in constant + ┌─ tests/move_check/typing/recursive_constant.move:4:20 + │ +4 │ const Y: u64 = X; + │ ^ Other constants are not supported in constants + diff --git a/third_party/move/move-compiler/tests/move_check/typing/recursive_constant.move b/third_party/move/move-compiler/tests/move_check/typing/recursive_constant.move new file mode 100644 index 00000000000000..bf342fcfa62826 --- /dev/null +++ b/third_party/move/move-compiler/tests/move_check/typing/recursive_constant.move @@ -0,0 +1,15 @@ +address 0x42 { +module M { + const X: u64 = Y; + const Y: u64 = X; + const Z: u64 = 0; + + public fun get_x(): u64 { + X + } + + public fun get_y(): u64 { + Y + } +} +}