From 5e81feedbec51097c9f09c1e4e55945c80926009 Mon Sep 17 00:00:00 2001 From: "Brian R. Murphy" <132495859+brmataptos@users.noreply.github.com> Date: Mon, 17 Jun 2024 14:25:28 -0700 Subject: [PATCH 01/11] disable verify_only code by default in move-compiler-v2 and add plumbing and tests that it is set when appropriate --- third_party/move/move-compiler-v2/src/lib.rs | 3 + .../move/move-compiler-v2/src/options.rs | 66 ++++++++++++++++++- .../cross_module_valid.verification | 0 .../double_annotation.verification | 0 .../noverify/cross_module_invalid.exp | 7 ++ .../noverify/cross_module_invalid.move | 26 ++++++++ .../noverify/cross_module_valid.exp | 2 + .../noverify/cross_module_valid.move | 24 +++++++ .../noverify/double_annotation.exp | 2 + .../noverify/double_annotation.move | 21 ++++++ .../noverify/single_module_invalid.exp | 19 ++++++ .../noverify/single_module_invalid.move | 19 ++++++ .../noverify/single_module_valid.exp | 2 + .../noverify/single_module_valid.move | 16 +++++ .../single_module_invalid.verification | 0 .../single_module_valid.verification | 0 .../verify/cross_module_valid.exp | 2 + .../verify/cross_module_valid.move | 24 +++++++ .../verification/verify/double_annotation.exp | 20 ++++++ .../verify/double_annotation.move | 21 ++++++ .../verify/single_module_valid.exp | 2 + .../verify/single_module_valid.move | 16 +++++ .../move/move-compiler-v2/tests/testsuite.rs | 51 +++++++++++++- .../move/move-compiler-v2/tests/v1.matched | 12 ++++ .../move/move-compiler-v2/tests/v1.unmatched | 10 +-- .../tools/testdiff/src/main.rs | 10 ++- .../transactional-tests/tests/v1.matched | 5 +- .../move/move-compiler/src/shared/mod.rs | 7 ++ third_party/move/move-model/src/lib.rs | 6 ++ third_party/move/move-prover/src/lib.rs | 3 + 30 files changed, 382 insertions(+), 14 deletions(-) create mode 100644 third_party/move/move-compiler-v2/tests/more-v1/verification/cross_module_valid.verification create mode 100644 third_party/move/move-compiler-v2/tests/more-v1/verification/double_annotation.verification create mode 100644 third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/cross_module_invalid.exp create mode 100644 third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/cross_module_invalid.move create mode 100644 third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/cross_module_valid.exp create mode 100644 third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/cross_module_valid.move create mode 100644 third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/double_annotation.exp create mode 100644 third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/double_annotation.move create mode 100644 third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/single_module_invalid.exp create mode 100644 third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/single_module_invalid.move create mode 100644 third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/single_module_valid.exp create mode 100644 third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/single_module_valid.move create mode 100644 third_party/move/move-compiler-v2/tests/more-v1/verification/single_module_invalid.verification create mode 100644 third_party/move/move-compiler-v2/tests/more-v1/verification/single_module_valid.verification create mode 100644 third_party/move/move-compiler-v2/tests/more-v1/verification/verify/cross_module_valid.exp create mode 100644 third_party/move/move-compiler-v2/tests/more-v1/verification/verify/cross_module_valid.move create mode 100644 third_party/move/move-compiler-v2/tests/more-v1/verification/verify/double_annotation.exp create mode 100644 third_party/move/move-compiler-v2/tests/more-v1/verification/verify/double_annotation.move create mode 100644 third_party/move/move-compiler-v2/tests/more-v1/verification/verify/single_module_valid.exp create mode 100644 third_party/move/move-compiler-v2/tests/more-v1/verification/verify/single_module_valid.move diff --git a/third_party/move/move-compiler-v2/src/lib.rs b/third_party/move/move-compiler-v2/src/lib.rs index d46eab6916f7e..2ee3067e492d7 100644 --- a/third_party/move/move-compiler-v2/src/lib.rs +++ b/third_party/move/move-compiler-v2/src/lib.rs @@ -185,7 +185,10 @@ pub fn run_checker(options: Options) -> anyhow::Result { &options.known_attributes }, options.language_version.unwrap_or_default(), + options.warn_deprecated, + options.warn_of_deprecation_use_in_aptos_libs, options.compile_test_code, + options.compile_verify_code, )?; // Store address aliases let map = addrs diff --git a/third_party/move/move-compiler-v2/src/options.rs b/third_party/move/move-compiler-v2/src/options.rs index bb8933ad163c9..60bc379f7211f 100644 --- a/third_party/move/move-compiler-v2/src/options.rs +++ b/third_party/move/move-compiler-v2/src/options.rs @@ -6,8 +6,14 @@ use crate::experiments::{DefaultValue, EXPERIMENTS}; use clap::Parser; use codespan_reporting::diagnostic::Severity; use itertools::Itertools; -use move_command_line_common::env::read_env_var; -use move_compiler::command_line as cli; +use move_command_line_common::env::{bool_to_str, read_env_var}; +use move_compiler::{ + command_line as cli, + shared::{ + move_compiler_warn_of_deprecation_use_env_var, + warn_of_deprecation_use_in_aptos_libs_env_var, + }, +}; use move_model::metadata::LanguageVersion; use once_cell::sync::Lazy; use std::{ @@ -25,29 +31,36 @@ pub struct Options { num_args = 0.. )] pub dependencies: Vec, + /// Named address mapping. #[clap( short, num_args = 0.. )] pub named_address_mapping: Vec, + /// Output directory. #[clap(short, long, default_value = "")] pub output_dir: String, + /// The language version to use. #[clap(long, value_parser = clap::value_parser!(LanguageVersion))] pub language_version: Option, + /// Do not complain about unknown attributes in Move code. #[clap(long, default_value = "false")] pub skip_attribute_checks: bool, + /// Known attributes for this dialect of move; if empty, assumes third-party Move. /// Only used if skip_attribute_checks is false. #[clap(skip)] pub known_attributes: BTreeSet, + /// Whether we generate code for tests. This specifically guarantees stable output /// for baseline testing. #[clap(long)] pub testing: bool, + /// Active experiments. Experiments alter default behavior of the compiler. /// See `Experiment` struct. #[clap(short)] @@ -56,31 +69,52 @@ pub struct Options { num_args = 0.. )] pub experiments: Vec, + /// A transient cache for memoization of experiment checks. #[clap(skip)] pub experiment_cache: RefCell>, + /// Sources to compile (positional arg, therefore last). /// Each source should be a path to either (1) a Move file or (2) a directory containing Move /// files, all to be compiled (e.g., not the root directory of a package---which contains /// Move.toml---but a specific subdirectorysuch as `sources`, `scripts`, and/or `tests`, /// depending on compilation mode). pub sources: Vec, + /// Dependencies to compile but not treat as a test/docgen/warning/prover target. /// Each source_dep should be a path to either (1) a Move file or (2) a directory containing /// Move files, all to be compiled (e.g., not the root directory of a package---which contains /// Move.toml---but a specific subdirectorysuch as `sources`). #[clap(skip)] pub sources_deps: Vec, + + #[clap(long = cli::MOVE_COMPILER_WARN_OF_DEPRECATION_USE_FLAG, + default_value=bool_to_str(move_compiler_warn_of_deprecation_use_env_var()))] + pub warn_deprecated: bool, + + /// Show warnings about use of deprecated usage in the Aptos libraries, + /// which we should generally not bother users with. + /// Note that current value of this constant is "Wdeprecation-aptos" + #[clap(long = cli::WARN_OF_DEPRECATION_USE_IN_APTOS_LIBS_FLAG, + default_value=bool_to_str(warn_of_deprecation_use_in_aptos_libs_env_var()))] + pub warn_of_deprecation_use_in_aptos_libs: bool, + /// Show warnings about unused functions, fields, constants, etc. /// Note that the current value of this constant is "Wunused" #[clap(long = cli::WARN_UNUSED_FLAG, default_value="false")] pub warn_unused: bool, + /// Whether to compile everything, including dependencies. #[clap(long)] pub whole_program: bool, + /// Whether to compile #[test] and #[test_only] code #[clap(skip)] pub compile_test_code: bool, + + /// Whether to compile #[verify_only] code + #[clap(skip)] + pub compile_verify_code: bool, } impl Default for Options { @@ -169,6 +203,34 @@ impl Options { ..self } } + + pub fn set_compile_verify_code(self, value: bool) -> Self { + Self { + compile_verify_code: value, + ..self + } + } + + pub fn set_warn_deprecated(self, value: bool) -> Self { + Self { + warn_deprecated: value, + ..self + } + } + + pub fn set_warn_of_deprecation_use_in_aptos_libs(self, value: bool) -> Self { + Self { + warn_of_deprecation_use_in_aptos_libs: value, + ..self + } + } + + pub fn set_warn_unused(self, value: bool) -> Self { + Self { + warn_unused: value, + ..self + } + } } /// Finds the experiment in the list of definitions. A definition diff --git a/third_party/move/move-compiler-v2/tests/more-v1/verification/cross_module_valid.verification b/third_party/move/move-compiler-v2/tests/more-v1/verification/cross_module_valid.verification new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/third_party/move/move-compiler-v2/tests/more-v1/verification/double_annotation.verification b/third_party/move/move-compiler-v2/tests/more-v1/verification/double_annotation.verification new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/cross_module_invalid.exp b/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/cross_module_invalid.exp new file mode 100644 index 0000000000000..b7e7d23306aa8 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/cross_module_invalid.exp @@ -0,0 +1,7 @@ + +Diagnostics: +error: unbound module + ┌─ tests/more-v1/verification/noverify/cross_module_invalid.move:23:9 + │ +23 │ A::build_foo() + │ ^ Unbound module alias 'A' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/cross_module_invalid.move b/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/cross_module_invalid.move new file mode 100644 index 0000000000000..9d78d065a3d6c --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/cross_module_invalid.move @@ -0,0 +1,26 @@ +// check that `use`'s are filtered out correctly +address 0x1 { +module A { + struct Foo has drop {} + + public fun build_foo(): Foo { Foo {} } +} + +module B { + #[verify_only] + use 0x1::A::{Self, Foo}; + + #[verify_only] + fun x(_: Foo) { } + + #[verify_only] + fun tester() { + x(A::build_foo()) + } + + // this should fail + public fun bad(): Foo { + A::build_foo() + } +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/cross_module_valid.exp b/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/cross_module_valid.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/cross_module_valid.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/cross_module_valid.move b/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/cross_module_valid.move new file mode 100644 index 0000000000000..c141dc283e65f --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/cross_module_valid.move @@ -0,0 +1,24 @@ +// Check that verify_only filtering and calling is supported across modules and +// different types of module members +address 0x1 { +module A { + #[verify_only] + struct Foo has drop {} + + #[verify_only] + public fun build_foo(): Foo { Foo {} } +} + +module B { + #[verify_only] + use 0x1::A::{Self, Foo}; + + #[verify_only] + fun x(_: Foo) { } + + #[verify_only] + fun tester() { + x(A::build_foo()) + } +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/double_annotation.exp b/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/double_annotation.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/double_annotation.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/double_annotation.move b/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/double_annotation.move new file mode 100644 index 0000000000000..60f63be52a624 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/double_annotation.move @@ -0,0 +1,21 @@ +address 0x1 { +module M { + #[verify_only] + struct Foo {} + + // failure: double annotation + #[verify_only] + #[verify_only] + struct Bar {} + + public fun foo() { } + + #[verify_only] + public fun bar() { } + + // failure: double annotation + #[verify_only] + #[verify_only] + public fun d(_a: signer, _b: signer) { } +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/single_module_invalid.exp b/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/single_module_invalid.exp new file mode 100644 index 0000000000000..8933693cbc7f7 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/single_module_invalid.exp @@ -0,0 +1,19 @@ + +Diagnostics: +error: undeclared `0x1::M::Foo` + ┌─ tests/more-v1/verification/noverify/single_module_invalid.move:8:23 + │ +8 │ public fun foo(): Foo { + │ ^^^ + +error: undeclared struct `M::Foo` + ┌─ tests/more-v1/verification/noverify/single_module_invalid.move:9:9 + │ +9 │ Foo {} + │ ^^^ + +error: no function named `bar` found + ┌─ tests/more-v1/verification/noverify/single_module_invalid.move:17:24 + │ +17 │ public fun baz() { bar() } + │ ^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/single_module_invalid.move b/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/single_module_invalid.move new file mode 100644 index 0000000000000..06043755f6307 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/single_module_invalid.move @@ -0,0 +1,19 @@ +address 0x1 { +module M { + #[verify_only] + struct Foo {} + + // This should cause an unbound type error in non-verify mode + // as the Foo struct declaration was filtered out + public fun foo(): Foo { + Foo {} + } + + #[verify_only] + public fun bar() { } + + // This should cause an unbound function error in non-verify mode + // as `bar` was filtered out + public fun baz() { bar() } +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/single_module_valid.exp b/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/single_module_valid.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/single_module_valid.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/single_module_valid.move b/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/single_module_valid.move new file mode 100644 index 0000000000000..a50d4ab3cf7da --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/single_module_valid.move @@ -0,0 +1,16 @@ +// Make sure that legal usage is allowed +module 0x1::M { + // verify-only struct + #[verify_only] + struct Foo {} + + public fun foo() { } + + // verify-only struct used in a verify-only function + #[verify_only] + public fun bar(): Foo { Foo{} } + + // verify-only function used in a verify-only function + #[verify_only] + public fun baz(): Foo { bar() } +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/verification/single_module_invalid.verification b/third_party/move/move-compiler-v2/tests/more-v1/verification/single_module_invalid.verification new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/third_party/move/move-compiler-v2/tests/more-v1/verification/single_module_valid.verification b/third_party/move/move-compiler-v2/tests/more-v1/verification/single_module_valid.verification new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/third_party/move/move-compiler-v2/tests/more-v1/verification/verify/cross_module_valid.exp b/third_party/move/move-compiler-v2/tests/more-v1/verification/verify/cross_module_valid.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/verification/verify/cross_module_valid.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/verification/verify/cross_module_valid.move b/third_party/move/move-compiler-v2/tests/more-v1/verification/verify/cross_module_valid.move new file mode 100644 index 0000000000000..c141dc283e65f --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/verification/verify/cross_module_valid.move @@ -0,0 +1,24 @@ +// Check that verify_only filtering and calling is supported across modules and +// different types of module members +address 0x1 { +module A { + #[verify_only] + struct Foo has drop {} + + #[verify_only] + public fun build_foo(): Foo { Foo {} } +} + +module B { + #[verify_only] + use 0x1::A::{Self, Foo}; + + #[verify_only] + fun x(_: Foo) { } + + #[verify_only] + fun tester() { + x(A::build_foo()) + } +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/verification/verify/double_annotation.exp b/third_party/move/move-compiler-v2/tests/more-v1/verification/verify/double_annotation.exp new file mode 100644 index 0000000000000..141935281706e --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/verification/verify/double_annotation.exp @@ -0,0 +1,20 @@ + +Diagnostics: +error: duplicate declaration, item, or annotation + ┌─ tests/more-v1/verification/verify/double_annotation.move:8:7 + │ +7 │ #[verify_only] + │ ----------- Attribute previously given here +8 │ #[verify_only] + │ ^^^^^^^^^^^ Duplicate attribute 'verify_only' attached to the same item + +error: duplicate declaration, item, or annotation + ┌─ tests/more-v1/verification/verify/double_annotation.move:18:7 + │ +17 │ #[verify_only] + │ ----------- Attribute previously given here +18 │ #[verify_only] + │ ^^^^^^^^^^^ Duplicate attribute 'verify_only' attached to the same item + + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/verification/verify/double_annotation.move b/third_party/move/move-compiler-v2/tests/more-v1/verification/verify/double_annotation.move new file mode 100644 index 0000000000000..60f63be52a624 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/verification/verify/double_annotation.move @@ -0,0 +1,21 @@ +address 0x1 { +module M { + #[verify_only] + struct Foo {} + + // failure: double annotation + #[verify_only] + #[verify_only] + struct Bar {} + + public fun foo() { } + + #[verify_only] + public fun bar() { } + + // failure: double annotation + #[verify_only] + #[verify_only] + public fun d(_a: signer, _b: signer) { } +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/verification/verify/single_module_valid.exp b/third_party/move/move-compiler-v2/tests/more-v1/verification/verify/single_module_valid.exp new file mode 100644 index 0000000000000..90b32906711cc --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/verification/verify/single_module_valid.exp @@ -0,0 +1,2 @@ + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/verification/verify/single_module_valid.move b/third_party/move/move-compiler-v2/tests/more-v1/verification/verify/single_module_valid.move new file mode 100644 index 0000000000000..a50d4ab3cf7da --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/verification/verify/single_module_valid.move @@ -0,0 +1,16 @@ +// Make sure that legal usage is allowed +module 0x1::M { + // verify-only struct + #[verify_only] + struct Foo {} + + public fun foo() { } + + // verify-only struct used in a verify-only function + #[verify_only] + public fun bar(): Foo { Foo{} } + + // verify-only function used in a verify-only function + #[verify_only] + public fun baz(): Foo { bar() } +} diff --git a/third_party/move/move-compiler-v2/tests/testsuite.rs b/third_party/move/move-compiler-v2/tests/testsuite.rs index 14d5be58213a7..8af7571146254 100644 --- a/third_party/move/move-compiler-v2/tests/testsuite.rs +++ b/third_party/move/move-compiler-v2/tests/testsuite.rs @@ -198,11 +198,25 @@ const TEST_CONFIGS: Lazy> = Lazy::new(|| { dump_bytecode: DumpLevel::None, // do not dump anything dump_bytecode_filter: None, }, + // Tests for more-v1 tests + TestConfig { + name: "more-v1", + runner: |p| run_test(p, get_config_by_name("more-v1")), + include: vec!["/more-v1/"], + exclude: vec![], + exp_suffix: None, + options: opts.clone().set_experiment(Experiment::AST_SIMPLIFY, true), + // Run the entire compiler pipeline to double-check the result + stop_after: StopAfter::FileFormat, + dump_ast: DumpLevel::None, + dump_bytecode: DumpLevel::None, // do not dump anything + dump_bytecode_filter: None, + }, // Tests for inlining, simplifier, and folding TestConfig { name: "inlining-et-al", runner: |p| run_test(p, get_config_by_name("inlining-et-al")), - include: vec!["/inlining/", "/folding/", "/simplifier/"], + include: vec!["/inlining/", "/folding/", "/simplifier/", "/more-v1/"], exclude: vec![], exp_suffix: None, options: opts.clone().set_experiment(Experiment::AST_SIMPLIFY, true), @@ -539,6 +553,39 @@ const TEST_CONFIGS: Lazy> = Lazy::new(|| { dump_bytecode: DumpLevel::None, dump_bytecode_filter: None, }, + // Test for verify on and off + TestConfig { + name: "verification", + runner: |p| run_test(p, get_config_by_name("verification")), + include: vec!["/verification/verify/"], + exclude: vec![], + exp_suffix: None, + options: opts + .clone() + .set_experiment(Experiment::AST_SIMPLIFY, true) + .set_compile_test_code(true), + // Run the entire compiler pipeline to double-check the result + stop_after: StopAfter::FileFormat, + dump_ast: DumpLevel::None, + dump_bytecode: DumpLevel::None, + dump_bytecode_filter: None, + }, + TestConfig { + name: "verification-off", + runner: |p| run_test(p, get_config_by_name("verification-off")), + include: vec!["/verification/noverify/"], + exclude: vec![], + exp_suffix: None, + options: opts + .clone() + .set_experiment(Experiment::AST_SIMPLIFY, true) + .set_compile_test_code(false), + // Run the entire compiler pipeline to double-check the result + stop_after: StopAfter::FileFormat, + dump_ast: DumpLevel::None, + dump_bytecode: DumpLevel::None, + dump_bytecode_filter: None, + }, TestConfig { name: "skip-attribute-checks", runner: |p| run_test(p, get_config_by_name("skip-attribute-checks")), @@ -574,6 +621,8 @@ fn run_test(path: &Path, config: TestConfig) -> datatest_stable::Result<()> { let path_str = path.display().to_string(); let mut options = config.options.clone(); options.warn_unused = path_str.contains("/unused/"); + options.warn_deprecated = path_str.contains("/deprecated/"); + options.compile_verify_code = path_str.contains("/verification/verify/"); options.sources_deps = extract_test_directives(path, "// dep:")?; options.sources = vec![path_str.clone()]; options.dependencies = if extract_test_directives(path, "// no-stdlib")?.is_empty() { diff --git a/third_party/move/move-compiler-v2/tests/v1.matched b/third_party/move/move-compiler-v2/tests/v1.matched index 25a816e67c53f..9df992d46a17c 100644 --- a/third_party/move/move-compiler-v2/tests/v1.matched +++ b/third_party/move/move-compiler-v2/tests/v1.matched @@ -1,3 +1,6 @@ +WARNING: test `move-compiler-v2/tests/more-v1/verification/cross_module_valid.verification.move` and `move-compiler-v2/tests/more-v1/verification/verify/cross_module_valid.move` share common key `verification/cross_module_valid.verification.move`, discarding former one +WARNING: test `move-compiler-v2/tests/more-v1/verification/double_annotation.verification.move` and `move-compiler-v2/tests/more-v1/verification/verify/double_annotation.move` share common key `verification/double_annotation.verification.move`, discarding former one +WARNING: test `move-compiler-v2/tests/more-v1/verification/single_module_valid.verification.move` and `move-compiler-v2/tests/more-v1/verification/verify/single_module_valid.move` share common key `verification/single_module_valid.verification.move`, discarding former one move-compiler/tests/move_check/translated_ir_tests/move/borrow_tests/borrow_global_acquires_1.exp move-compiler-v2/tests/acquires-checker/v1-borrow-tests/borrow_global_acquires_1.exp move-compiler/tests/move_check/translated_ir_tests/move/borrow_tests/borrow_global_acquires_2.exp move-compiler-v2/tests/acquires-checker/v1-borrow-tests/borrow_global_acquires_2.exp move-compiler/tests/move_check/translated_ir_tests/move/borrow_tests/borrow_global_acquires_3.exp move-compiler-v2/tests/acquires-checker/v1-borrow-tests/borrow_global_acquires_3.exp @@ -623,3 +626,12 @@ move-compiler/tests/move_check/unit_test/test_filter_function.exp move-compile move-compiler/tests/move_check/unit_test/test_filter_struct.exp move-compiler-v2/tests/unit_test/notest/test_filter_struct.exp move-compiler/tests/move_check/unit_test/valid_test_module.exp move-compiler-v2/tests/unit_test/notest/valid_test_module.exp move-compiler/tests/move_check/unit_test/valid_test_module.unit_test.exp move-compiler-v2/tests/unit_test/test/valid_test_module.exp +move-compiler/tests/move_check/verification/cross_module_invalid.exp move-compiler-v2/tests/more-v1/verification/noverify/cross_module_invalid.exp +move-compiler/tests/move_check/verification/cross_module_valid.exp move-compiler-v2/tests/more-v1/verification/noverify/cross_module_valid.exp +move-compiler/tests/move_check/verification/cross_module_valid.verification.exp move-compiler-v2/tests/more-v1/verification/verify/cross_module_valid.exp +move-compiler/tests/move_check/verification/double_annotation.exp move-compiler-v2/tests/more-v1/verification/noverify/double_annotation.exp +move-compiler/tests/move_check/verification/double_annotation.verification.exp move-compiler-v2/tests/more-v1/verification/verify/double_annotation.exp +move-compiler/tests/move_check/verification/single_module_invalid.exp move-compiler-v2/tests/more-v1/verification/noverify/single_module_invalid.exp +move-compiler/tests/move_check/verification/single_module_invalid.verification.exp move-compiler-v2/tests/more-v1/verification/single_module_invalid.verification.exp +move-compiler/tests/move_check/verification/single_module_valid.exp move-compiler-v2/tests/more-v1/verification/noverify/single_module_valid.exp +move-compiler/tests/move_check/verification/single_module_valid.verification.exp move-compiler-v2/tests/more-v1/verification/verify/single_module_valid.exp diff --git a/third_party/move/move-compiler-v2/tests/v1.unmatched b/third_party/move/move-compiler-v2/tests/v1.unmatched index f2ad6f0903cec..ad3263c90aa00 100644 --- a/third_party/move/move-compiler-v2/tests/v1.unmatched +++ b/third_party/move/move-compiler-v2/tests/v1.unmatched @@ -1,3 +1,6 @@ +WARNING: test `move-compiler-v2/tests/more-v1/verification/cross_module_valid.verification.move` and `move-compiler-v2/tests/more-v1/verification/verify/cross_module_valid.move` share common key `verification/cross_module_valid.verification.move`, discarding former one +WARNING: test `move-compiler-v2/tests/more-v1/verification/double_annotation.verification.move` and `move-compiler-v2/tests/more-v1/verification/verify/double_annotation.move` share common key `verification/double_annotation.verification.move`, discarding former one +WARNING: test `move-compiler-v2/tests/more-v1/verification/single_module_valid.verification.move` and `move-compiler-v2/tests/more-v1/verification/verify/single_module_valid.move` share common key `verification/single_module_valid.verification.move`, discarding former one move-compiler/tests/move_check/borrow_tests/{ borrow_global_acquires_duplicate_annotation.move, eq_bad.move, @@ -279,10 +282,3 @@ move-compiler/tests/move_check/typing/{ move-compiler/tests/move_check/v2-not-supported/{ no_receiver_calls.move, } -move-compiler/tests/move_check/verification/{ - cross_module_invalid.move, - cross_module_valid.move, - double_annotation.move, - single_module_invalid.move, - single_module_valid.move, -} diff --git a/third_party/move/move-compiler-v2/tools/testdiff/src/main.rs b/third_party/move/move-compiler-v2/tools/testdiff/src/main.rs index cc33da8171255..c3c7b93ebaf3b 100644 --- a/third_party/move/move-compiler-v2/tools/testdiff/src/main.rs +++ b/third_party/move/move-compiler-v2/tools/testdiff/src/main.rs @@ -97,8 +97,8 @@ static UNIT_PATH_REMAP: Lazy> = Lazy::new(|| { ("acquires-checker/v1-borrow-tests", "borrow_tests"), ("attributes", "parser"), ("unit_test/notest", "unit_test"), - // Map file v2../unit_test/test/foo.move - // to file v1../unit_test/foo.unit_test.move. + // Map file v2../unit_test/test/foo.exp + // to file v1../unit_test/foo.unit_test.exp. ("unit_test/test", "unit_test.unit_test"), ("unused-assignment/v1-locals", "locals"), ("unused-assignment/v1-liveness", "liveness"), @@ -108,6 +108,10 @@ static UNIT_PATH_REMAP: Lazy> = Lazy::new(|| { ("ability-check/v1-signer", "signer"), ("ability-check/v1-borrow-tests", "commands"), ("ability-check/v1-locals", "locals"), + ("verification/noverify", "verification"), + // Map file v2../verification/verify/foo.exp + // to file v1../verification/foo.verification.exp. + ("verification/verify", "verification.verification"), ] }); @@ -205,7 +209,7 @@ fn collect_tests(root: &str) -> anyhow::Result> { let path_str = path.display().to_string(); if path_str.ends_with(".move") { result.insert(path); - } else if path_str.ends_with(".unit_test") { + } else if path_str.ends_with(".unit_test") || path_str.ends_with(".verification") { result.insert(PathBuf::from(format!("{}.{}", path_str, "move"))); } } diff --git a/third_party/move/move-compiler-v2/transactional-tests/tests/v1.matched b/third_party/move/move-compiler-v2/transactional-tests/tests/v1.matched index fecee90c8f243..db793a356d40e 100644 --- a/third_party/move/move-compiler-v2/transactional-tests/tests/v1.matched +++ b/third_party/move/move-compiler-v2/transactional-tests/tests/v1.matched @@ -1,5 +1,7 @@ move-compiler/transactional-tests/tests/constants/by_reference.exp move-compiler-v2/transactional-tests/tests/constants/by_reference.exp move-compiler/transactional-tests/tests/constants/default_int_size.exp move-compiler-v2/transactional-tests/tests/constants/default_int_size.exp +move-compiler/transactional-tests/tests/constants/empty_vectors.exp move-compiler-v2/transactional-tests/tests/constants/empty_vectors.exp +move-compiler/transactional-tests/tests/constants/empty_vectors2.exp move-compiler-v2/transactional-tests/tests/constants/empty_vectors2.exp move-compiler/transactional-tests/tests/constants/folding_boolean.exp move-compiler-v2/transactional-tests/tests/constants/folding_boolean.exp move-compiler/transactional-tests/tests/constants/folding_complex.exp move-compiler-v2/transactional-tests/tests/constants/folding_complex.exp move-compiler/transactional-tests/tests/constants/folding_equality.exp move-compiler-v2/transactional-tests/tests/constants/folding_equality.exp @@ -8,8 +10,9 @@ move-compiler/transactional-tests/tests/constants/folding_values.exp move-comp move-compiler/transactional-tests/tests/constants/folding_vector.exp move-compiler-v2/transactional-tests/tests/constants/folding_vector.exp move-compiler/transactional-tests/tests/constants/folding_vector_large.exp move-compiler-v2/transactional-tests/tests/constants/folding_vector_large.exp move-compiler/transactional-tests/tests/constants/non_constant_empty_vec.exp move-compiler-v2/transactional-tests/tests/constants/non_constant_empty_vec.exp +move-compiler/transactional-tests/tests/constants/nonempty_vectors.exp move-compiler-v2/transactional-tests/tests/constants/nonempty_vectors.exp move-compiler/transactional-tests/tests/control_flow/assert_in_while.exp move-compiler-v2/transactional-tests/tests/control_flow/assert_in_while.exp -move-compiler/transactional-tests/tests/control_flow/binop_eval_order.exp move-compiler-v2/transactional-tests/tests/control_flow/binop_eval_order.exp +move-compiler/transactional-tests/tests/control_flow/binop_eval_order.exp move-compiler-v2/transactional-tests/tests/operator_eval/control_flow/binop_eval_order.exp move-compiler/transactional-tests/tests/control_flow/branch_assigns_then_moves_then_assigns.exp move-compiler-v2/transactional-tests/tests/control_flow/branch_assigns_then_moves_then_assigns.exp move-compiler/transactional-tests/tests/control_flow/break_accumulator.exp move-compiler-v2/transactional-tests/tests/control_flow/break_accumulator.exp move-compiler/transactional-tests/tests/control_flow/break_continue_for_loop.exp move-compiler-v2/transactional-tests/tests/control_flow/break_continue_for_loop.exp diff --git a/third_party/move/move-compiler/src/shared/mod.rs b/third_party/move/move-compiler/src/shared/mod.rs index c14b9ce386ac9..2a5c50f9a6ada 100644 --- a/third_party/move/move-compiler/src/shared/mod.rs +++ b/third_party/move/move-compiler/src/shared/mod.rs @@ -481,6 +481,13 @@ impl Flags { } } + pub fn set_verify(self, value: bool) -> Self { + Self { + verify: value, + ..self + } + } + pub fn set_keep_testing_functions(self, value: bool) -> Self { Self { keep_testing_functions: value, diff --git a/third_party/move/move-model/src/lib.rs b/third_party/move/move-model/src/lib.rs index dcc5b81e66fe0..d6d795ca5f67d 100644 --- a/third_party/move/move-model/src/lib.rs +++ b/third_party/move/move-model/src/lib.rs @@ -90,7 +90,10 @@ pub fn run_model_builder_in_compiler_mode( skip_attribute_checks: bool, known_attributes: &BTreeSet, language_version: LanguageVersion, + warn_of_deprecation_use: bool, + warn_of_deprecation_use_in_aptos_libs: bool, compile_test_code: bool, + compile_verify_code: bool, ) -> anyhow::Result { let to_package_paths = |PackageInfo { sources, @@ -110,7 +113,10 @@ pub fn run_model_builder_in_compiler_mode( ..ModelBuilderOptions::default() }, Flags::model_compilation() + .set_warn_of_deprecation_use(warn_of_deprecation_use) + .set_warn_of_deprecation_use_in_aptos_libs(warn_of_deprecation_use_in_aptos_libs) .set_skip_attribute_checks(skip_attribute_checks) + .set_verify(compile_verify_code) .set_keep_testing_functions(compile_test_code) .set_lang_v2(language_version != LanguageVersion::V1) .set_compiler_v2(true), diff --git a/third_party/move/move-prover/src/lib.rs b/third_party/move/move-prover/src/lib.rs index 9cf607d374075..d5f4e9f308463 100644 --- a/third_party/move/move-prover/src/lib.rs +++ b/third_party/move/move-prover/src/lib.rs @@ -84,9 +84,12 @@ pub fn run_move_prover_v2( experiment_cache: Default::default(), sources: cloned_options.move_sources, sources_deps: vec![], + warn_deprecated: false, + warn_of_deprecation_use_in_aptos_libs: false, warn_unused: false, whole_program: false, compile_test_code: false, + compile_verify_code: true, }; let mut env = move_compiler_v2::run_move_compiler_for_analysis(error_writer, compiler_options)?; From 8988c27b286dba1072fcf218ab2f8e19d9d14c93 Mon Sep 17 00:00:00 2001 From: "Brian R. Murphy" <132495859+brmataptos@users.noreply.github.com> Date: Mon, 17 Jun 2024 15:04:13 -0700 Subject: [PATCH 02/11] add tests of deprecated warnings --- .../deprecated_constant_duplicated_struct.exp | 27 ++++ ...deprecated_constant_duplicated_struct.move | 44 ++++++ ...deprecated_constant_duplicated_struct2.exp | 145 ++++++++++++++++++ ...eprecated_constant_duplicated_struct2.move | 44 ++++++ .../deprecated/deprecated_field_type.exp | 31 ++++ .../deprecated/deprecated_field_type.move | 30 ++++ .../deprecated/deprecated_field_type2.exp | 13 ++ .../deprecated/deprecated_field_type2.move | 31 ++++ .../deprecated_placement_address.exp | 22 +++ .../deprecated_placement_address.move | 34 ++++ ...cated_placement_address_module_members.exp | 76 +++++++++ ...ated_placement_address_module_members.move | 42 +++++ .../deprecated_placement_members.exp | 40 +++++ .../deprecated_placement_members.move | 39 +++++ .../deprecated_placement_module.exp | 22 +++ .../deprecated_placement_module.move | 34 ++++ .../deprecated_placement_module2.exp | 49 ++++++ .../deprecated_placement_module2.move | 34 ++++ .../deprecated_placement_module_members.exp | 76 +++++++++ .../deprecated_placement_module_members.move | 41 +++++ .../more-v1/deprecated/public_script.exp | 13 ++ .../more-v1/deprecated/public_script.move | 6 + .../move/move-compiler-v2/tests/v1.matched | 11 ++ .../move/move-compiler-v2/tests/v1.unmatched | 11 -- 24 files changed, 904 insertions(+), 11 deletions(-) create mode 100644 third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_constant_duplicated_struct.exp create mode 100644 third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_constant_duplicated_struct.move create mode 100644 third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_constant_duplicated_struct2.exp create mode 100644 third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_constant_duplicated_struct2.move create mode 100644 third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_field_type.exp create mode 100644 third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_field_type.move create mode 100644 third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_field_type2.exp create mode 100644 third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_field_type2.move create mode 100644 third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_address.exp create mode 100644 third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_address.move create mode 100644 third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_address_module_members.exp create mode 100644 third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_address_module_members.move create mode 100644 third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_members.exp create mode 100644 third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_members.move create mode 100644 third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_module.exp create mode 100644 third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_module.move create mode 100644 third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_module2.exp create mode 100644 third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_module2.move create mode 100644 third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_module_members.exp create mode 100644 third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_module_members.move create mode 100644 third_party/move/move-compiler-v2/tests/more-v1/deprecated/public_script.exp create mode 100644 third_party/move/move-compiler-v2/tests/more-v1/deprecated/public_script.move 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 9df992d46a17c..56577566e080d 100644 --- a/third_party/move/move-compiler-v2/tests/v1.matched +++ b/third_party/move/move-compiler-v2/tests/v1.matched @@ -155,6 +155,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 ad3263c90aa00..9ee038364c30c 100644 --- a/third_party/move/move-compiler-v2/tests/v1.unmatched +++ b/third_party/move/move-compiler-v2/tests/v1.unmatched @@ -34,18 +34,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, From 5d695f507c81966211e902ba6626759000cbdc33 Mon Sep 17 00:00:00 2001 From: "Brian R. Murphy" <132495859+brmataptos@users.noreply.github.com> Date: Mon, 17 Jun 2024 17:17:45 -0700 Subject: [PATCH 03/11] turn 'unresolved spec target' error into a warning unless is_verification and keep_testing_functions --- .../move-model/src/builder/module_builder.rs | 11 +++++++- third_party/move/move-model/src/lib.rs | 2 ++ third_party/move/move-model/src/model.rs | 26 +++++++++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/third_party/move/move-model/src/builder/module_builder.rs b/third_party/move/move-model/src/builder/module_builder.rs index a934b63aa7924..e9140f8d2dd1f 100644 --- a/third_party/move/move-model/src/builder/module_builder.rs +++ b/third_party/move/move-model/src/builder/module_builder.rs @@ -941,7 +941,16 @@ impl<'env, 'translator> ModuleBuilder<'env, 'translator> { }, None => { let loc = self.parent.to_loc(&spec.value.target.loc); - self.parent.error(&loc, "unresolved spec target"); + if self.parent.env.is_verification() && self.parent.env.keep_testing_functions() + { + // Only error out on an unknown spec target if we could not + // have elided any as `#[test_only]` or `#[verify_only]`. + self.parent.error(&loc, "unresolved spec target"); + } else { + self.parent + .env + .diag(Severity::Warning, &loc, "unresolved spec target"); + } }, } } diff --git a/third_party/move/move-model/src/lib.rs b/third_party/move/move-model/src/lib.rs index d6d795ca5f67d..030a7f59838fb 100644 --- a/third_party/move/move-model/src/lib.rs +++ b/third_party/move/move-model/src/lib.rs @@ -167,6 +167,8 @@ pub fn run_model_builder_with_options_and_compilation_flags< env.set_language_version(options.language_version); let compile_via_model = options.compile_via_model; env.set_extension(options); + env.set_is_verification(flags.is_verification()); + env.set_keep_testing_functions(flags.keep_testing_functions()); let move_sources = move_sources_targets .iter() diff --git a/third_party/move/move-model/src/model.rs b/third_party/move/move-model/src/model.rs index eb485ab3cd5ee..6285cef3f7f18 100644 --- a/third_party/move/move-model/src/model.rs +++ b/third_party/move/move-model/src/model.rs @@ -582,6 +582,10 @@ pub struct GlobalEnv { /// Whether the v2 compiler has generated this model. /// TODO: replace with a proper version number once we have this in file format pub(crate) generated_by_v2: bool, + /// Whether verification is happening. + pub(crate) is_verification: bool, + /// Whether we are keeping testing functions. + pub(crate) keep_testing_functions: bool, } /// A helper type for implementing fmt::Display depending on GlobalEnv @@ -643,6 +647,8 @@ impl GlobalEnv { address_alias_map: Default::default(), everything_is_target: Default::default(), generated_by_v2: false, + is_verification: false, + keep_testing_functions: false, } } @@ -656,6 +662,26 @@ impl GlobalEnv { self.generated_by_v2 } + /// Sets whether this is being used for verification. + pub fn set_is_verification(&mut self, yes: bool) { + self.is_verification = yes + } + + /// Returns true if this is being used for verification. + pub fn is_verification(&self) -> bool { + self.is_verification + } + + /// Sets whether we are keeping testing functions. + pub fn set_keep_testing_functions(&mut self, yes: bool) { + self.keep_testing_functions = yes + } + + /// Returns true if we are keeping testing functions. + pub fn keep_testing_functions(&self) -> bool { + self.keep_testing_functions + } + /// Sets the language version. pub fn set_language_version(&mut self, version: LanguageVersion) { self.language_version = version From 7ed21a1b1a2a5471aacaeeb36fa305e67cc24833 Mon Sep 17 00:00:00 2001 From: "Brian R. Murphy" <132495859+brmataptos@users.noreply.github.com> Date: Mon, 17 Jun 2024 18:48:43 -0700 Subject: [PATCH 04/11] Revert "turn 'unresolved spec target' error into a warning unless is_verification and keep_testing_functions" This reverts commit 355e14e306cb081066fe841f2b0d48a11d221833. --- .../move-model/src/builder/module_builder.rs | 11 +------- third_party/move/move-model/src/lib.rs | 2 -- third_party/move/move-model/src/model.rs | 26 ------------------- 3 files changed, 1 insertion(+), 38 deletions(-) diff --git a/third_party/move/move-model/src/builder/module_builder.rs b/third_party/move/move-model/src/builder/module_builder.rs index e9140f8d2dd1f..a934b63aa7924 100644 --- a/third_party/move/move-model/src/builder/module_builder.rs +++ b/third_party/move/move-model/src/builder/module_builder.rs @@ -941,16 +941,7 @@ impl<'env, 'translator> ModuleBuilder<'env, 'translator> { }, None => { let loc = self.parent.to_loc(&spec.value.target.loc); - if self.parent.env.is_verification() && self.parent.env.keep_testing_functions() - { - // Only error out on an unknown spec target if we could not - // have elided any as `#[test_only]` or `#[verify_only]`. - self.parent.error(&loc, "unresolved spec target"); - } else { - self.parent - .env - .diag(Severity::Warning, &loc, "unresolved spec target"); - } + self.parent.error(&loc, "unresolved spec target"); }, } } diff --git a/third_party/move/move-model/src/lib.rs b/third_party/move/move-model/src/lib.rs index 030a7f59838fb..d6d795ca5f67d 100644 --- a/third_party/move/move-model/src/lib.rs +++ b/third_party/move/move-model/src/lib.rs @@ -167,8 +167,6 @@ pub fn run_model_builder_with_options_and_compilation_flags< env.set_language_version(options.language_version); let compile_via_model = options.compile_via_model; env.set_extension(options); - env.set_is_verification(flags.is_verification()); - env.set_keep_testing_functions(flags.keep_testing_functions()); let move_sources = move_sources_targets .iter() diff --git a/third_party/move/move-model/src/model.rs b/third_party/move/move-model/src/model.rs index 6285cef3f7f18..eb485ab3cd5ee 100644 --- a/third_party/move/move-model/src/model.rs +++ b/third_party/move/move-model/src/model.rs @@ -582,10 +582,6 @@ pub struct GlobalEnv { /// Whether the v2 compiler has generated this model. /// TODO: replace with a proper version number once we have this in file format pub(crate) generated_by_v2: bool, - /// Whether verification is happening. - pub(crate) is_verification: bool, - /// Whether we are keeping testing functions. - pub(crate) keep_testing_functions: bool, } /// A helper type for implementing fmt::Display depending on GlobalEnv @@ -647,8 +643,6 @@ impl GlobalEnv { address_alias_map: Default::default(), everything_is_target: Default::default(), generated_by_v2: false, - is_verification: false, - keep_testing_functions: false, } } @@ -662,26 +656,6 @@ impl GlobalEnv { self.generated_by_v2 } - /// Sets whether this is being used for verification. - pub fn set_is_verification(&mut self, yes: bool) { - self.is_verification = yes - } - - /// Returns true if this is being used for verification. - pub fn is_verification(&self) -> bool { - self.is_verification - } - - /// Sets whether we are keeping testing functions. - pub fn set_keep_testing_functions(&mut self, yes: bool) { - self.keep_testing_functions = yes - } - - /// Returns true if we are keeping testing functions. - pub fn keep_testing_functions(&self) -> bool { - self.keep_testing_functions - } - /// Sets the language version. pub fn set_language_version(&mut self, version: LanguageVersion) { self.language_version = version From a876ce96fc92294822f60c8feb5c2f47cd24f257 Mon Sep 17 00:00:00 2001 From: "Brian R. Murphy" <132495859+brmataptos@users.noreply.github.com> Date: Mon, 17 Jun 2024 18:58:55 -0700 Subject: [PATCH 05/11] add tests for #13737 --- .../noverify/function_with_spec.exp | 13 +++++++++++ .../noverify/function_with_spec.move | 19 ++++++++++++++++ .../verify/function_with_spec.exp | 10 +++++++++ .../verify/function_with_spec.move | 19 ++++++++++++++++ .../unit_test/notest/function_with_spec.exp | 13 +++++++++++ .../unit_test/notest/function_with_spec.move | 22 +++++++++++++++++++ .../unit_test/test/function_with_spec.exp | 10 +++++++++ .../unit_test/test/function_with_spec.move | 22 +++++++++++++++++++ 8 files changed, 128 insertions(+) create mode 100644 third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/function_with_spec.exp create mode 100644 third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/function_with_spec.move create mode 100644 third_party/move/move-compiler-v2/tests/more-v1/verification/verify/function_with_spec.exp create mode 100644 third_party/move/move-compiler-v2/tests/more-v1/verification/verify/function_with_spec.move create mode 100644 third_party/move/move-compiler-v2/tests/unit_test/notest/function_with_spec.exp create mode 100644 third_party/move/move-compiler-v2/tests/unit_test/notest/function_with_spec.move create mode 100644 third_party/move/move-compiler-v2/tests/unit_test/test/function_with_spec.exp create mode 100644 third_party/move/move-compiler-v2/tests/unit_test/test/function_with_spec.move diff --git a/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/function_with_spec.exp b/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/function_with_spec.exp new file mode 100644 index 0000000000000..8813dd56cc765 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/function_with_spec.exp @@ -0,0 +1,13 @@ + +Diagnostics: +error: unresolved spec target + ┌─ tests/more-v1/verification/noverify/function_with_spec.move:10:10 + │ +10 │ spec bar { + │ ^^^ + +error: unresolved spec target + ┌─ tests/more-v1/verification/noverify/function_with_spec.move:15:10 + │ +15 │ spec baz { + │ ^^^ diff --git a/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/function_with_spec.move b/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/function_with_spec.move new file mode 100644 index 0000000000000..4671968e37fd2 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/function_with_spec.move @@ -0,0 +1,19 @@ +// #[test_only] functions should be filtered out in non-test mode +address 0x1234 { +module M { + public fun foo() { } + + #[verify_only] + public fun bar() { } + + // This should not cause an error in either test- nor non-test-mode. + spec bar { + aborts_if false; + } + + // This should always cause an error due to typo. + spec baz { + aborts_if false; + } +} +} diff --git a/third_party/move/move-compiler-v2/tests/more-v1/verification/verify/function_with_spec.exp b/third_party/move/move-compiler-v2/tests/more-v1/verification/verify/function_with_spec.exp new file mode 100644 index 0000000000000..81708f74de71f --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/verification/verify/function_with_spec.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unresolved spec target + ┌─ tests/more-v1/verification/verify/function_with_spec.move:15:10 + │ +15 │ spec baz { + │ ^^^ + + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/more-v1/verification/verify/function_with_spec.move b/third_party/move/move-compiler-v2/tests/more-v1/verification/verify/function_with_spec.move new file mode 100644 index 0000000000000..4671968e37fd2 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/more-v1/verification/verify/function_with_spec.move @@ -0,0 +1,19 @@ +// #[test_only] functions should be filtered out in non-test mode +address 0x1234 { +module M { + public fun foo() { } + + #[verify_only] + public fun bar() { } + + // This should not cause an error in either test- nor non-test-mode. + spec bar { + aborts_if false; + } + + // This should always cause an error due to typo. + spec baz { + aborts_if false; + } +} +} diff --git a/third_party/move/move-compiler-v2/tests/unit_test/notest/function_with_spec.exp b/third_party/move/move-compiler-v2/tests/unit_test/notest/function_with_spec.exp new file mode 100644 index 0000000000000..cb1abd73de574 --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/unit_test/notest/function_with_spec.exp @@ -0,0 +1,13 @@ + +Diagnostics: +error: unresolved spec target + ┌─ tests/unit_test/notest/function_with_spec.move:13:10 + │ +13 │ spec bar { + │ ^^^ + +error: unresolved spec target + ┌─ tests/unit_test/notest/function_with_spec.move:18:10 + │ +18 │ spec baz { + │ ^^^ diff --git a/third_party/move/move-compiler-v2/tests/unit_test/notest/function_with_spec.move b/third_party/move/move-compiler-v2/tests/unit_test/notest/function_with_spec.move new file mode 100644 index 0000000000000..ed9d79304088e --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/unit_test/notest/function_with_spec.move @@ -0,0 +1,22 @@ +// #[test_only] functions should be filtered out in non-test mode +address 0x1234 { +module M { + public fun foo() { } + + #[test] + public fun bar_test() { bar() } + + #[test_only] + public fun bar() { } + + // This should not cause an error in either test- nor non-test-mode. + spec bar { + aborts_if false; + } + + // This should always cause an error due to typo. + spec baz { + aborts_if false; + } +} +} diff --git a/third_party/move/move-compiler-v2/tests/unit_test/test/function_with_spec.exp b/third_party/move/move-compiler-v2/tests/unit_test/test/function_with_spec.exp new file mode 100644 index 0000000000000..fbcda8c812a5b --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/unit_test/test/function_with_spec.exp @@ -0,0 +1,10 @@ + +Diagnostics: +error: unresolved spec target + ┌─ tests/unit_test/test/function_with_spec.move:18:10 + │ +18 │ spec baz { + │ ^^^ + + +============ bytecode verification succeeded ======== diff --git a/third_party/move/move-compiler-v2/tests/unit_test/test/function_with_spec.move b/third_party/move/move-compiler-v2/tests/unit_test/test/function_with_spec.move new file mode 100644 index 0000000000000..ed9d79304088e --- /dev/null +++ b/third_party/move/move-compiler-v2/tests/unit_test/test/function_with_spec.move @@ -0,0 +1,22 @@ +// #[test_only] functions should be filtered out in non-test mode +address 0x1234 { +module M { + public fun foo() { } + + #[test] + public fun bar_test() { bar() } + + #[test_only] + public fun bar() { } + + // This should not cause an error in either test- nor non-test-mode. + spec bar { + aborts_if false; + } + + // This should always cause an error due to typo. + spec baz { + aborts_if false; + } +} +} From 71f276d5ad7cd056f29b6a7eb68ef373dd419491 Mon Sep 17 00:00:00 2001 From: Wolfgang Grieskamp Date: Mon, 17 Jun 2024 18:35:25 -0700 Subject: [PATCH 06/11] [compiler] Filter out spec blocks of filtered module members Closes #13737. This removes, in the generic parser AST filter, spec blocks for members which are filtered out. For example, for a `#[test_only]` function which is filtered out, also an associated spec block will be removed. This works equally for other attributes like `#[verify_only]` thanks to the generic filter logic. --- .../move/move-compiler/src/parser/filter.rs | 43 ++++++++++++++++--- 1 file changed, 37 insertions(+), 6 deletions(-) diff --git a/third_party/move/move-compiler/src/parser/filter.rs b/third_party/move/move-compiler/src/parser/filter.rs index c205a3ffa36ed..fe09adcb4af28 100644 --- a/third_party/move/move-compiler/src/parser/filter.rs +++ b/third_party/move/move-compiler/src/parser/filter.rs @@ -2,8 +2,13 @@ // Copyright (c) The Move Contributors // SPDX-License-Identifier: Apache-2.0 -use crate::parser::ast as P; +use crate::parser::{ + ast as P, + ast::{ModuleMember, SpecBlockTarget_}, +}; use move_ir_types::location::sp; +use move_symbol_pool::Symbol; +use std::collections::BTreeSet; /// A trait that decides whether to include a parsed element in the compilation pub trait FilterContext { @@ -56,8 +61,10 @@ pub trait FilterContext { &mut self, function_def: P::Function, is_source_def: bool, + filtered_members: &mut BTreeSet, ) -> Option { if self.should_remove_by_attributes(&function_def.attributes, is_source_def) { + filtered_members.insert(function_def.name.0.value); None } else { Some(function_def) @@ -68,8 +75,10 @@ pub trait FilterContext { &mut self, struct_def: P::StructDefinition, is_source_def: bool, + filtered_members: &mut BTreeSet, ) -> Option { if self.should_remove_by_attributes(&struct_def.attributes, is_source_def) { + filtered_members.insert(struct_def.name.0.value); None } else { Some(struct_def) @@ -233,7 +242,8 @@ fn filter_script( // This is a bit weird, if the only function in the script is filtered, we consider // the whole script is filtered as well - let new_function = context.filter_map_function(function, is_source_def)?; + let new_function = + context.filter_map_function(function, is_source_def, &mut BTreeSet::new())?; let new_uses = uses .into_iter() @@ -278,9 +288,29 @@ fn filter_module( members, } = module_def; + // Collected filtered members in this set (functions and structs) + let mut filtered_members = BTreeSet::new(); + let new_members: Vec<_> = members .into_iter() - .filter_map(|member| filter_module_member(context, member, is_source_def)) + .filter_map(|member| { + filter_module_member(context, member, is_source_def, &mut filtered_members) + }) + .collect(); + + // Now remove all spec blocks for members which are filtered out + let new_members_filtered_spec_blocks = new_members + .into_iter() + .filter(|mem| { + if let ModuleMember::Spec(spec) = mem { + if let SpecBlockTarget_::Member(name, _) = &spec.value.target.value { + if filtered_members.contains(&name.value) { + return false; + } + } + } + true + }) .collect(); Some(P::ModuleDefinition { @@ -289,7 +319,7 @@ fn filter_module( address, name, is_spec_module, - members: new_members, + members: new_members_filtered_spec_blocks, }) } @@ -297,15 +327,16 @@ fn filter_module_member( context: &mut T, module_member: P::ModuleMember, is_source_def: bool, + filtered_members: &mut BTreeSet, ) -> Option { use P::ModuleMember as PM; match module_member { PM::Function(func_def) => context - .filter_map_function(func_def, is_source_def) + .filter_map_function(func_def, is_source_def, filtered_members) .map(PM::Function), PM::Struct(struct_def) => context - .filter_map_struct(struct_def, is_source_def) + .filter_map_struct(struct_def, is_source_def, filtered_members) .map(PM::Struct), PM::Spec(sp!(spec_loc, spec)) => context .filter_map_spec(spec, is_source_def) From f572b3346710346b93016e25db469c350efefbe0 Mon Sep 17 00:00:00 2001 From: "Brian R. Murphy" <132495859+brmataptos@users.noreply.github.com> Date: Mon, 17 Jun 2024 19:01:14 -0700 Subject: [PATCH 07/11] update tests after Wolfgang's commit --- .../more-v1/verification/noverify/function_with_spec.exp | 6 ------ .../tests/unit_test/notest/function_with_spec.exp | 6 ------ 2 files changed, 12 deletions(-) diff --git a/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/function_with_spec.exp b/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/function_with_spec.exp index 8813dd56cc765..db08d679d6f75 100644 --- a/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/function_with_spec.exp +++ b/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/function_with_spec.exp @@ -1,11 +1,5 @@ Diagnostics: -error: unresolved spec target - ┌─ tests/more-v1/verification/noverify/function_with_spec.move:10:10 - │ -10 │ spec bar { - │ ^^^ - error: unresolved spec target ┌─ tests/more-v1/verification/noverify/function_with_spec.move:15:10 │ diff --git a/third_party/move/move-compiler-v2/tests/unit_test/notest/function_with_spec.exp b/third_party/move/move-compiler-v2/tests/unit_test/notest/function_with_spec.exp index cb1abd73de574..ed74cc91d766e 100644 --- a/third_party/move/move-compiler-v2/tests/unit_test/notest/function_with_spec.exp +++ b/third_party/move/move-compiler-v2/tests/unit_test/notest/function_with_spec.exp @@ -1,11 +1,5 @@ Diagnostics: -error: unresolved spec target - ┌─ tests/unit_test/notest/function_with_spec.move:13:10 - │ -13 │ spec bar { - │ ^^^ - error: unresolved spec target ┌─ tests/unit_test/notest/function_with_spec.move:18:10 │ From f6d29c78f0f8e3f7e1d5e521426218a1c8947d4f Mon Sep 17 00:00:00 2001 From: "Brian R. Murphy" <132495859+brmataptos@users.noreply.github.com> Date: Mon, 17 Jun 2024 19:27:12 -0700 Subject: [PATCH 08/11] update test outputs after merge --- .../compilation/std-lib-conflicts/Move.v2_exp | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 third_party/move/tools/move-package/tests/test_sources/compilation/std-lib-conflicts/Move.v2_exp diff --git a/third_party/move/tools/move-package/tests/test_sources/compilation/std-lib-conflicts/Move.v2_exp b/third_party/move/tools/move-package/tests/test_sources/compilation/std-lib-conflicts/Move.v2_exp new file mode 100644 index 0000000000000..842d430239fea --- /dev/null +++ b/third_party/move/tools/move-package/tests/test_sources/compilation/std-lib-conflicts/Move.v2_exp @@ -0,0 +1,53 @@ +CompiledPackageInfo { + package_name: "std-lib-conflicts", + address_alias_instantiation: { + "A": 0000000000000000000000000000000000000000000000000000000000000042, + "B": 0000000000000000000000000000000000000000000000000000000000000043, + "Extensions": 0000000000000000000000000000000000000000000000000000000000000001, + "aptos_framework": 0000000000000000000000000000000000000000000000000000000000000001, + "aptos_fungible_asset": 000000000000000000000000000000000000000000000000000000000000000a, + "aptos_std": 0000000000000000000000000000000000000000000000000000000000000001, + "aptos_token": 0000000000000000000000000000000000000000000000000000000000000003, + "core_resources": 000000000000000000000000000000000000000000000000000000000a550c18, + "std": 0000000000000000000000000000000000000000000000000000000000000001, + "vm": 0000000000000000000000000000000000000000000000000000000000000000, + "vm_reserved": 0000000000000000000000000000000000000000000000000000000000000000, + }, + source_digest: Some( + "ELIDED_FOR_TEST", + ), + build_flags: BuildConfig { + dev_mode: true, + test_mode: false, + override_std: None, + generate_docs: false, + generate_abis: false, + generate_move_model: false, + full_model_generation: false, + install_dir: Some( + "ELIDED_FOR_TEST", + ), + force_recompilation: false, + additional_named_addresses: {}, + architecture: None, + fetch_deps_only: false, + skip_fetch_latest_git_deps: false, + compiler_config: CompilerConfig { + bytecode_version: None, + known_attributes: { + "bytecode_instruction", + "deprecated", + "expected_failure", + "native_interface", + "test", + "test_only", + "verify_only", + }, + skip_attribute_checks: false, + compiler_version: Some( + V2_0, + ), + language_version: None, + }, + }, +} From e8fd47f75d55ca181f71d4a3c8386e300689760b Mon Sep 17 00:00:00 2001 From: "Brian R. Murphy" <132495859+brmataptos@users.noreply.github.com> Date: Fri, 28 Jun 2024 17:47:29 -0700 Subject: [PATCH 09/11] add missing changed test output --- .../more-v1/verification/noverify/cross_module_invalid.exp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/cross_module_invalid.exp b/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/cross_module_invalid.exp index b7e7d23306aa8..9ab00f7e922ff 100644 --- a/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/cross_module_invalid.exp +++ b/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/cross_module_invalid.exp @@ -4,4 +4,4 @@ error: unbound module ┌─ tests/more-v1/verification/noverify/cross_module_invalid.move:23:9 │ 23 │ A::build_foo() - │ ^ Unbound module alias 'A' + │ ^ Unbound module or type alias 'A' From eae8fad4a280db9ed6d86203da99038ebf70a3f2 Mon Sep 17 00:00:00 2001 From: "Brian R. Murphy" <132495859+brmataptos@users.noreply.github.com> Date: Sat, 29 Jun 2024 16:04:35 -0700 Subject: [PATCH 10/11] only run verification with verification stage --- third_party/move/move-compiler-v2/tests/testsuite.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third_party/move/move-compiler-v2/tests/testsuite.rs b/third_party/move/move-compiler-v2/tests/testsuite.rs index 8af7571146254..8a95992d14204 100644 --- a/third_party/move/move-compiler-v2/tests/testsuite.rs +++ b/third_party/move/move-compiler-v2/tests/testsuite.rs @@ -217,7 +217,7 @@ const TEST_CONFIGS: Lazy> = Lazy::new(|| { name: "inlining-et-al", runner: |p| run_test(p, get_config_by_name("inlining-et-al")), include: vec!["/inlining/", "/folding/", "/simplifier/", "/more-v1/"], - exclude: vec![], + exclude: vec!["/more-v1/verification/"], exp_suffix: None, options: opts.clone().set_experiment(Experiment::AST_SIMPLIFY, true), // Run the entire compiler pipeline to double-check the result From aa91e66056658506c986b72b071ffa809df66e69 Mon Sep 17 00:00:00 2001 From: "Brian R. Murphy" <132495859+brmataptos@users.noreply.github.com> Date: Sat, 29 Jun 2024 16:22:56 -0700 Subject: [PATCH 11/11] fix test configurations for verification and deprecated --- .../deprecated_constant_duplicated_struct.exp | 8 ++--- ...deprecated_constant_duplicated_struct.move | 0 ...deprecated_constant_duplicated_struct2.exp | 34 +++++++++---------- ...eprecated_constant_duplicated_struct2.move | 0 .../deprecated/deprecated_field_type.exp | 6 ++-- .../deprecated/deprecated_field_type.move | 0 .../deprecated/deprecated_field_type2.exp | 2 +- .../deprecated/deprecated_field_type2.move | 0 .../deprecated_placement_address.exp | 4 +-- .../deprecated_placement_address.move | 0 ...cated_placement_address_module_members.exp | 16 ++++----- ...ated_placement_address_module_members.move | 0 .../deprecated_placement_members.exp | 8 ++--- .../deprecated_placement_members.move | 0 .../deprecated_placement_module.exp | 4 +-- .../deprecated_placement_module.move | 0 .../deprecated_placement_module2.exp | 10 +++--- .../deprecated_placement_module2.move | 0 .../deprecated_placement_module_members.exp | 16 ++++----- .../deprecated_placement_module_members.move | 0 .../deprecated/public_script.exp | 4 +-- .../deprecated/public_script.move | 0 .../move/move-compiler-v2/tests/testsuite.rs | 34 +++++++++---------- .../cross_module_valid.verification | 0 .../double_annotation.verification | 0 .../noverify/cross_module_invalid.exp | 2 +- .../noverify/cross_module_invalid.move | 0 .../noverify/cross_module_valid.exp | 0 .../noverify/cross_module_valid.move | 0 .../noverify/double_annotation.exp | 0 .../noverify/double_annotation.move | 0 .../noverify/function_with_spec.exp | 2 +- .../noverify/function_with_spec.move | 0 .../noverify/single_module_invalid.exp | 6 ++-- .../noverify/single_module_invalid.move | 0 .../noverify/single_module_valid.exp | 0 .../noverify/single_module_valid.move | 0 .../single_module_invalid.verification | 0 .../single_module_valid.verification | 0 .../verify/cross_module_valid.exp | 0 .../verify/cross_module_valid.move | 0 .../verification/verify/double_annotation.exp | 4 +-- .../verify/double_annotation.move | 0 .../verify/function_with_spec.exp | 2 +- .../verify/function_with_spec.move | 0 .../verify/single_module_valid.exp | 0 .../verify/single_module_valid.move | 0 47 files changed, 81 insertions(+), 81 deletions(-) rename third_party/move/move-compiler-v2/tests/{more-v1 => }/deprecated/deprecated_constant_duplicated_struct.exp (68%) rename third_party/move/move-compiler-v2/tests/{more-v1 => }/deprecated/deprecated_constant_duplicated_struct.move (100%) rename third_party/move/move-compiler-v2/tests/{more-v1 => }/deprecated/deprecated_constant_duplicated_struct2.exp (73%) rename third_party/move/move-compiler-v2/tests/{more-v1 => }/deprecated/deprecated_constant_duplicated_struct2.move (100%) rename third_party/move/move-compiler-v2/tests/{more-v1 => }/deprecated/deprecated_field_type.exp (83%) rename third_party/move/move-compiler-v2/tests/{more-v1 => }/deprecated/deprecated_field_type.move (100%) rename third_party/move/move-compiler-v2/tests/{more-v1 => }/deprecated/deprecated_field_type2.exp (85%) rename third_party/move/move-compiler-v2/tests/{more-v1 => }/deprecated/deprecated_field_type2.move (100%) rename third_party/move/move-compiler-v2/tests/{more-v1 => }/deprecated/deprecated_placement_address.exp (76%) rename third_party/move/move-compiler-v2/tests/{more-v1 => }/deprecated/deprecated_placement_address.move (100%) rename third_party/move/move-compiler-v2/tests/{more-v1 => }/deprecated/deprecated_placement_address_module_members.exp (73%) rename third_party/move/move-compiler-v2/tests/{more-v1 => }/deprecated/deprecated_placement_address_module_members.move (100%) rename third_party/move/move-compiler-v2/tests/{more-v1 => }/deprecated/deprecated_placement_members.exp (78%) rename third_party/move/move-compiler-v2/tests/{more-v1 => }/deprecated/deprecated_placement_members.move (100%) rename third_party/move/move-compiler-v2/tests/{more-v1 => }/deprecated/deprecated_placement_module.exp (76%) rename third_party/move/move-compiler-v2/tests/{more-v1 => }/deprecated/deprecated_placement_module.move (100%) rename third_party/move/move-compiler-v2/tests/{more-v1 => }/deprecated/deprecated_placement_module2.exp (76%) rename third_party/move/move-compiler-v2/tests/{more-v1 => }/deprecated/deprecated_placement_module2.move (100%) rename third_party/move/move-compiler-v2/tests/{more-v1 => }/deprecated/deprecated_placement_module_members.exp (74%) rename third_party/move/move-compiler-v2/tests/{more-v1 => }/deprecated/deprecated_placement_module_members.move (100%) rename third_party/move/move-compiler-v2/tests/{more-v1 => }/deprecated/public_script.exp (78%) rename third_party/move/move-compiler-v2/tests/{more-v1 => }/deprecated/public_script.move (100%) rename third_party/move/move-compiler-v2/tests/{more-v1 => }/verification/cross_module_valid.verification (100%) rename third_party/move/move-compiler-v2/tests/{more-v1 => }/verification/double_annotation.verification (100%) rename third_party/move/move-compiler-v2/tests/{more-v1 => }/verification/noverify/cross_module_invalid.exp (61%) rename third_party/move/move-compiler-v2/tests/{more-v1 => }/verification/noverify/cross_module_invalid.move (100%) rename third_party/move/move-compiler-v2/tests/{more-v1 => }/verification/noverify/cross_module_valid.exp (100%) rename third_party/move/move-compiler-v2/tests/{more-v1 => }/verification/noverify/cross_module_valid.move (100%) rename third_party/move/move-compiler-v2/tests/{more-v1 => }/verification/noverify/double_annotation.exp (100%) rename third_party/move/move-compiler-v2/tests/{more-v1 => }/verification/noverify/double_annotation.move (100%) rename third_party/move/move-compiler-v2/tests/{more-v1 => }/verification/noverify/function_with_spec.exp (55%) rename third_party/move/move-compiler-v2/tests/{more-v1 => }/verification/noverify/function_with_spec.move (100%) rename third_party/move/move-compiler-v2/tests/{more-v1 => }/verification/noverify/single_module_invalid.exp (57%) rename third_party/move/move-compiler-v2/tests/{more-v1 => }/verification/noverify/single_module_invalid.move (100%) rename third_party/move/move-compiler-v2/tests/{more-v1 => }/verification/noverify/single_module_valid.exp (100%) rename third_party/move/move-compiler-v2/tests/{more-v1 => }/verification/noverify/single_module_valid.move (100%) rename third_party/move/move-compiler-v2/tests/{more-v1 => }/verification/single_module_invalid.verification (100%) rename third_party/move/move-compiler-v2/tests/{more-v1 => }/verification/single_module_valid.verification (100%) rename third_party/move/move-compiler-v2/tests/{more-v1 => }/verification/verify/cross_module_valid.exp (100%) rename third_party/move/move-compiler-v2/tests/{more-v1 => }/verification/verify/cross_module_valid.move (100%) rename third_party/move/move-compiler-v2/tests/{more-v1 => }/verification/verify/double_annotation.exp (80%) rename third_party/move/move-compiler-v2/tests/{more-v1 => }/verification/verify/double_annotation.move (100%) rename third_party/move/move-compiler-v2/tests/{more-v1 => }/verification/verify/function_with_spec.exp (66%) rename third_party/move/move-compiler-v2/tests/{more-v1 => }/verification/verify/function_with_spec.move (100%) rename third_party/move/move-compiler-v2/tests/{more-v1 => }/verification/verify/single_module_valid.exp (100%) rename third_party/move/move-compiler-v2/tests/{more-v1 => }/verification/verify/single_module_valid.move (100%) 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/deprecated/deprecated_constant_duplicated_struct.exp similarity index 68% rename from third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_constant_duplicated_struct.exp rename to third_party/move/move-compiler-v2/tests/deprecated/deprecated_constant_duplicated_struct.exp index c137632b65437..a30fe67df07d0 100644 --- a/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_constant_duplicated_struct.exp +++ b/third_party/move/move-compiler-v2/tests/deprecated/deprecated_constant_duplicated_struct.exp @@ -1,7 +1,7 @@ Diagnostics: error: duplicate declaration, item, or annotation - ┌─ tests/more-v1/deprecated/deprecated_constant_duplicated_struct.move:5:11 + ┌─ tests/deprecated/deprecated_constant_duplicated_struct.move:5:11 │ 4 │ struct C { } │ - Alias previously defined here @@ -9,19 +9,19 @@ error: duplicate declaration, item, or annotation │ ^ 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 + ┌─ tests/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 + ┌─ tests/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 + ┌─ tests/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/deprecated/deprecated_constant_duplicated_struct.move similarity index 100% rename from third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_constant_duplicated_struct.move rename to third_party/move/move-compiler-v2/tests/deprecated/deprecated_constant_duplicated_struct.move 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/deprecated/deprecated_constant_duplicated_struct2.exp similarity index 73% rename from third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_constant_duplicated_struct2.exp rename to third_party/move/move-compiler-v2/tests/deprecated/deprecated_constant_duplicated_struct2.exp index 29d61842638ca..9f0348c6e4d2e 100644 --- a/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_constant_duplicated_struct2.exp +++ b/third_party/move/move-compiler-v2/tests/deprecated/deprecated_constant_duplicated_struct2.exp @@ -1,7 +1,7 @@ Diagnostics: error: duplicate declaration, item, or annotation - ┌─ tests/more-v1/deprecated/deprecated_constant_duplicated_struct2.move:5:11 + ┌─ tests/deprecated/deprecated_constant_duplicated_struct2.move:5:11 │ 3 │ struct C { } │ - Alias previously defined here @@ -10,13 +10,13 @@ error: duplicate declaration, item, or annotation │ ^ 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 + ┌─ tests/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 + ┌─ tests/deprecated/deprecated_constant_duplicated_struct2.move:13:21 │ 4 │ #[deprecated] │ ---------- Constant 'C' in module '0x42::mod1' deprecated here @@ -25,7 +25,7 @@ warning: Use of deprecated constant │ ^ 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 + ┌─ tests/deprecated/deprecated_constant_duplicated_struct2.move:14:21 │ 4 │ #[deprecated] │ ---------- Constant 'C' in module '0x42::mod1' deprecated here @@ -34,7 +34,7 @@ warning: Use of deprecated constant │ ^ 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 + ┌─ tests/deprecated/deprecated_constant_duplicated_struct2.move:17:27 │ 4 │ #[deprecated] │ ---------- Struct 'C' in module '0x42::mod1' deprecated here @@ -43,7 +43,7 @@ warning: Use of deprecated struct │ ^ 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 + ┌─ tests/deprecated/deprecated_constant_duplicated_struct2.move:19:2 │ 4 │ #[deprecated] │ ---------- Member 'C' in module '0x42::mod1' deprecated here @@ -52,7 +52,7 @@ warning: Use of deprecated member │ ^ 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 + ┌─ tests/deprecated/deprecated_constant_duplicated_struct2.move:21:22 │ 4 │ #[deprecated] │ ---------- Constant 'C' in module '0x42::mod1' deprecated here @@ -61,7 +61,7 @@ warning: Use of deprecated constant │ ^ 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 + ┌─ tests/deprecated/deprecated_constant_duplicated_struct2.move:22:6 │ 4 │ #[deprecated] │ ---------- Member 'C' in module '0x42::mod1' deprecated here @@ -70,7 +70,7 @@ warning: Use of deprecated member │ ^ 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 + ┌─ tests/deprecated/deprecated_constant_duplicated_struct2.move:24:2 │ 4 │ #[deprecated] │ ---------- Member 'C' in module '0x42::mod1' deprecated here @@ -79,13 +79,13 @@ warning: Use of deprecated member │ ^ Use of deprecated member 'C' from module '0x42::mod1' warning: unused alias - ┌─ tests/more-v1/deprecated/deprecated_constant_duplicated_struct2.move:31:15 + ┌─ tests/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 + ┌─ tests/deprecated/deprecated_constant_duplicated_struct2.move:32:21 │ 4 │ #[deprecated] │ ---------- Constant 'C' in module '0x42::mod1' deprecated here @@ -94,13 +94,13 @@ warning: Use of deprecated constant │ ^ Use of deprecated constant 'C' from module '0x42::mod1' error: invalid name - ┌─ tests/more-v1/deprecated/deprecated_constant_duplicated_struct2.move:32:26 + ┌─ tests/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 + ┌─ tests/deprecated/deprecated_constant_duplicated_struct2.move:33:21 │ 4 │ #[deprecated] │ ---------- Constant 'C' in module '0x42::mod1' deprecated here @@ -109,7 +109,7 @@ warning: Use of deprecated constant │ ^ 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 + ┌─ tests/deprecated/deprecated_constant_duplicated_struct2.move:36:27 │ 4 │ #[deprecated] │ ---------- Struct 'C' in module '0x42::mod1' deprecated here @@ -118,7 +118,7 @@ warning: Use of deprecated struct │ ^ 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 + ┌─ tests/deprecated/deprecated_constant_duplicated_struct2.move:38:2 │ 4 │ #[deprecated] │ ---------- Member 'C' in module '0x42::mod1' deprecated here @@ -127,7 +127,7 @@ warning: Use of deprecated member │ ^ 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 + ┌─ tests/deprecated/deprecated_constant_duplicated_struct2.move:40:22 │ 4 │ #[deprecated] │ ---------- Constant 'C' in module '0x42::mod1' deprecated here @@ -136,7 +136,7 @@ warning: Use of deprecated constant │ ^ 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 + ┌─ tests/deprecated/deprecated_constant_duplicated_struct2.move:41:6 │ 4 │ #[deprecated] │ ---------- Member 'C' in module '0x42::mod1' deprecated here 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/deprecated/deprecated_constant_duplicated_struct2.move similarity index 100% rename from third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_constant_duplicated_struct2.move rename to third_party/move/move-compiler-v2/tests/deprecated/deprecated_constant_duplicated_struct2.move 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/deprecated/deprecated_field_type.exp similarity index 83% rename from third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_field_type.exp rename to third_party/move/move-compiler-v2/tests/deprecated/deprecated_field_type.exp index 232d6a4e19b9f..9b2175d2d571a 100644 --- a/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_field_type.exp +++ b/third_party/move/move-compiler-v2/tests/deprecated/deprecated_field_type.exp @@ -1,7 +1,7 @@ Diagnostics: warning: Use of deprecated struct - ┌─ tests/more-v1/deprecated/deprecated_field_type.move:17:22 + ┌─ tests/deprecated/deprecated_field_type.move:17:22 │ 3 │ #[deprecated] │ ---------- Struct 'EventHandle' in module '0x42::event' deprecated here @@ -10,7 +10,7 @@ warning: Use of deprecated struct │ ^^^^^^^^^^^ Use of deprecated struct 'EventHandle' from module '0x42::event' warning: Use of deprecated struct - ┌─ tests/more-v1/deprecated/deprecated_field_type.move:27:25 + ┌─ tests/deprecated/deprecated_field_type.move:27:25 │ 3 │ #[deprecated] │ ---------- Struct 'EventHandle' in module '0x42::event' deprecated here @@ -19,7 +19,7 @@ warning: Use of deprecated struct │ ^^^^^^^^^^^ Use of deprecated struct 'EventHandle' from module '0x42::event' warning: Use of deprecated struct - ┌─ tests/more-v1/deprecated/deprecated_field_type.move:28:26 + ┌─ tests/deprecated/deprecated_field_type.move:28:26 │ 3 │ #[deprecated] │ ---------- Struct 'EventHandle' in module '0x42::event' deprecated here 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/deprecated/deprecated_field_type.move similarity index 100% rename from third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_field_type.move rename to third_party/move/move-compiler-v2/tests/deprecated/deprecated_field_type.move 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/deprecated/deprecated_field_type2.exp similarity index 85% rename from third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_field_type2.exp rename to third_party/move/move-compiler-v2/tests/deprecated/deprecated_field_type2.exp index c5c33e8394476..9fd7327c3f1ee 100644 --- a/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_field_type2.exp +++ b/third_party/move/move-compiler-v2/tests/deprecated/deprecated_field_type2.exp @@ -1,7 +1,7 @@ Diagnostics: warning: Use of deprecated struct - ┌─ tests/more-v1/deprecated/deprecated_field_type2.move:29:38 + ┌─ tests/deprecated/deprecated_field_type2.move:29:38 │ 22 │ #[deprecated] │ ---------- Struct 'WithdrawEvent' in module '0x41::coin' deprecated here 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/deprecated/deprecated_field_type2.move similarity index 100% rename from third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_field_type2.move rename to third_party/move/move-compiler-v2/tests/deprecated/deprecated_field_type2.move 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/deprecated/deprecated_placement_address.exp similarity index 76% rename from third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_address.exp rename to third_party/move/move-compiler-v2/tests/deprecated/deprecated_placement_address.exp index d0f2fd0c21140..c492663d4fe27 100644 --- a/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_address.exp +++ b/third_party/move/move-compiler-v2/tests/deprecated/deprecated_placement_address.exp @@ -1,7 +1,7 @@ Diagnostics: warning: Use of deprecated module - ┌─ tests/more-v1/deprecated/deprecated_placement_address.move:25:9 + ┌─ tests/deprecated/deprecated_placement_address.move:25:9 │ 1 │ #[deprecated] │ ---------- Module '0x42::M' deprecated here @@ -10,7 +10,7 @@ warning: Use of deprecated module │ ^^^^^^^ Use of deprecated module '0x42::M' warning: Use of deprecated module - ┌─ tests/more-v1/deprecated/deprecated_placement_address.move:29:15 + ┌─ tests/deprecated/deprecated_placement_address.move:29:15 │ 1 │ #[deprecated] │ ---------- Module '0x42::M' deprecated here 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/deprecated/deprecated_placement_address.move similarity index 100% rename from third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_address.move rename to third_party/move/move-compiler-v2/tests/deprecated/deprecated_placement_address.move 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/deprecated/deprecated_placement_address_module_members.exp similarity index 73% rename from third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_address_module_members.exp rename to third_party/move/move-compiler-v2/tests/deprecated/deprecated_placement_address_module_members.exp index d96feb00d6582..9e1d702f7c4a8 100644 --- 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/deprecated/deprecated_placement_address_module_members.exp @@ -1,7 +1,7 @@ Diagnostics: warning: Use of deprecated module - ┌─ tests/more-v1/deprecated/deprecated_placement_address_module_members.move:33:9 + ┌─ tests/deprecated/deprecated_placement_address_module_members.move:33:9 │ 1 │ #[deprecated] // Think about using 0x43 instead │ ---------- Module '0x42::M' deprecated here @@ -10,7 +10,7 @@ warning: Use of deprecated module │ ^^^^^^^ Use of deprecated module '0x42::M' warning: Use of deprecated module - ┌─ tests/more-v1/deprecated/deprecated_placement_address_module_members.move:34:9 + ┌─ tests/deprecated/deprecated_placement_address_module_members.move:34:9 │ 20 │ #[deprecated] │ ---------- Module '0x41::N' deprecated here @@ -19,7 +19,7 @@ warning: Use of deprecated module │ ^^^^^^^ Use of deprecated module '0x41::N' warning: Use of deprecated struct - ┌─ tests/more-v1/deprecated/deprecated_placement_address_module_members.move:34:18 + ┌─ tests/deprecated/deprecated_placement_address_module_members.move:34:18 │ 22 │ #[deprecated] │ ---------- Struct 'S' in module '0x41::N' deprecated here @@ -28,7 +28,7 @@ warning: Use of deprecated struct │ ^ 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 + ┌─ tests/deprecated/deprecated_placement_address_module_members.move:37:11 │ 22 │ #[deprecated] │ ---------- Struct 'S' in module '0x41::N' deprecated here @@ -37,7 +37,7 @@ warning: Use of deprecated struct │ ^ 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 + ┌─ tests/deprecated/deprecated_placement_address_module_members.move:37:15 │ 1 │ #[deprecated] // Think about using 0x43 instead │ ---------- Module '0x42::M' deprecated here @@ -46,7 +46,7 @@ warning: Use of deprecated module │ ^ Use of deprecated module '0x42::M' warning: Use of deprecated function - ┌─ tests/more-v1/deprecated/deprecated_placement_address_module_members.move:37:18 + ┌─ tests/deprecated/deprecated_placement_address_module_members.move:37:18 │ 13 │ #[deprecated] │ ---------- Function 'foo' in module '0x42::M' deprecated here @@ -55,7 +55,7 @@ warning: Use of deprecated function │ ^^^ 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 + ┌─ tests/deprecated/deprecated_placement_address_module_members.move:38:2 │ 20 │ #[deprecated] │ ---------- Module '0x41::N' deprecated here @@ -64,7 +64,7 @@ warning: Use of deprecated module │ ^^^^^^^ Use of deprecated module '0x41::N' warning: Use of deprecated function - ┌─ tests/more-v1/deprecated/deprecated_placement_address_module_members.move:38:11 + ┌─ tests/deprecated/deprecated_placement_address_module_members.move:38:11 │ 28 │ #[deprecated] │ ---------- Function 'consume' in module '0x41::N' deprecated here 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/deprecated/deprecated_placement_address_module_members.move similarity index 100% rename from third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_address_module_members.move rename to third_party/move/move-compiler-v2/tests/deprecated/deprecated_placement_address_module_members.move 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/deprecated/deprecated_placement_members.exp similarity index 78% rename from third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_members.exp rename to third_party/move/move-compiler-v2/tests/deprecated/deprecated_placement_members.exp index ab4325eeea366..c5aa40b0e3e3f 100644 --- a/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_members.exp +++ b/third_party/move/move-compiler-v2/tests/deprecated/deprecated_placement_members.exp @@ -1,7 +1,7 @@ Diagnostics: warning: Use of deprecated struct - ┌─ tests/more-v1/deprecated/deprecated_placement_members.move:31:18 + ┌─ tests/deprecated/deprecated_placement_members.move:31:18 │ 19 │ #[deprecated] │ ---------- Struct 'S' in module '0x41::N' deprecated here @@ -10,7 +10,7 @@ warning: Use of deprecated struct │ ^ Use of deprecated struct 'S' from module '0x41::N' warning: Use of deprecated struct - ┌─ tests/more-v1/deprecated/deprecated_placement_members.move:34:11 + ┌─ tests/deprecated/deprecated_placement_members.move:34:11 │ 19 │ #[deprecated] │ ---------- Struct 'S' in module '0x41::N' deprecated here @@ -19,7 +19,7 @@ warning: Use of deprecated struct │ ^ Use of deprecated struct 'S' from module '0x41::N' warning: Use of deprecated function - ┌─ tests/more-v1/deprecated/deprecated_placement_members.move:34:18 + ┌─ tests/deprecated/deprecated_placement_members.move:34:18 │ 11 │ #[deprecated] │ ---------- Function 'foo' in module '0x42::M' deprecated here @@ -28,7 +28,7 @@ warning: Use of deprecated function │ ^^^ Use of deprecated function 'foo' from module '0x42::M' warning: Use of deprecated function - ┌─ tests/more-v1/deprecated/deprecated_placement_members.move:35:11 + ┌─ tests/deprecated/deprecated_placement_members.move:35:11 │ 25 │ #[deprecated] │ ---------- Function 'consume' in module '0x41::N' deprecated here 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/deprecated/deprecated_placement_members.move similarity index 100% rename from third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_members.move rename to third_party/move/move-compiler-v2/tests/deprecated/deprecated_placement_members.move 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/deprecated/deprecated_placement_module.exp similarity index 76% rename from third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_module.exp rename to third_party/move/move-compiler-v2/tests/deprecated/deprecated_placement_module.exp index acf06508493dc..68a6f21363dd5 100644 --- a/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_module.exp +++ b/third_party/move/move-compiler-v2/tests/deprecated/deprecated_placement_module.exp @@ -1,7 +1,7 @@ Diagnostics: warning: Use of deprecated module - ┌─ tests/more-v1/deprecated/deprecated_placement_module.move:25:9 + ┌─ tests/deprecated/deprecated_placement_module.move:25:9 │ 2 │ #[deprecated] │ ---------- Module '0x42::M' deprecated here @@ -10,7 +10,7 @@ warning: Use of deprecated module │ ^^^^^^^ Use of deprecated module '0x42::M' warning: Use of deprecated module - ┌─ tests/more-v1/deprecated/deprecated_placement_module.move:29:15 + ┌─ tests/deprecated/deprecated_placement_module.move:29:15 │ 2 │ #[deprecated] │ ---------- Module '0x42::M' deprecated here 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/deprecated/deprecated_placement_module.move similarity index 100% rename from third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_module.move rename to third_party/move/move-compiler-v2/tests/deprecated/deprecated_placement_module.move 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/deprecated/deprecated_placement_module2.exp similarity index 76% rename from third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_module2.exp rename to third_party/move/move-compiler-v2/tests/deprecated/deprecated_placement_module2.exp index a7f6d2a94dfb0..ab9447a567186 100644 --- a/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_module2.exp +++ b/third_party/move/move-compiler-v2/tests/deprecated/deprecated_placement_module2.exp @@ -1,7 +1,7 @@ Diagnostics: warning: Use of deprecated module - ┌─ tests/more-v1/deprecated/deprecated_placement_module2.move:3:9 + ┌─ tests/deprecated/deprecated_placement_module2.move:3:9 │ 3 │ use 0x41::N; │ ^^^^^^^ Use of deprecated module '0x41::N' @@ -10,7 +10,7 @@ warning: Use of deprecated module │ ---------- Module '0x41::N' deprecated here warning: Use of deprecated module - ┌─ tests/more-v1/deprecated/deprecated_placement_module2.move:9:23 + ┌─ tests/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' @@ -19,7 +19,7 @@ warning: Use of deprecated module │ ---------- Module '0x41::N' deprecated here warning: Use of deprecated module - ┌─ tests/more-v1/deprecated/deprecated_placement_module2.move:9:48 + ┌─ tests/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' @@ -28,7 +28,7 @@ warning: Use of deprecated module │ ---------- Module '0x41::N' deprecated here warning: Use of deprecated module - ┌─ tests/more-v1/deprecated/deprecated_placement_module2.move:26:9 + ┌─ tests/deprecated/deprecated_placement_module2.move:26:9 │ 15 │ #[deprecated] │ ---------- Module '0x41::N' deprecated here @@ -37,7 +37,7 @@ warning: Use of deprecated module │ ^^^^^^^ Use of deprecated module '0x41::N' warning: Use of deprecated module - ┌─ tests/more-v1/deprecated/deprecated_placement_module2.move:30:2 + ┌─ tests/deprecated/deprecated_placement_module2.move:30:2 │ 15 │ #[deprecated] │ ---------- Module '0x41::N' deprecated here 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/deprecated/deprecated_placement_module2.move similarity index 100% rename from third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_module2.move rename to third_party/move/move-compiler-v2/tests/deprecated/deprecated_placement_module2.move 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/deprecated/deprecated_placement_module_members.exp similarity index 74% rename from third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_module_members.exp rename to third_party/move/move-compiler-v2/tests/deprecated/deprecated_placement_module_members.exp index 2cb940362c35f..d8e3badc5994f 100644 --- a/third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_module_members.exp +++ b/third_party/move/move-compiler-v2/tests/deprecated/deprecated_placement_module_members.exp @@ -1,7 +1,7 @@ Diagnostics: warning: Use of deprecated module - ┌─ tests/more-v1/deprecated/deprecated_placement_module_members.move:32:9 + ┌─ tests/deprecated/deprecated_placement_module_members.move:32:9 │ 2 │ #[deprecated] │ ---------- Module '0x42::M' deprecated here @@ -10,7 +10,7 @@ warning: Use of deprecated module │ ^^^^^^^ Use of deprecated module '0x42::M' warning: Use of deprecated module - ┌─ tests/more-v1/deprecated/deprecated_placement_module_members.move:33:9 + ┌─ tests/deprecated/deprecated_placement_module_members.move:33:9 │ 19 │ #[deprecated] │ ---------- Module '0x41::N' deprecated here @@ -19,7 +19,7 @@ warning: Use of deprecated module │ ^^^^^^^ Use of deprecated module '0x41::N' warning: Use of deprecated struct - ┌─ tests/more-v1/deprecated/deprecated_placement_module_members.move:33:18 + ┌─ tests/deprecated/deprecated_placement_module_members.move:33:18 │ 21 │ #[deprecated] │ ---------- Struct 'S' in module '0x41::N' deprecated here @@ -28,7 +28,7 @@ warning: Use of deprecated struct │ ^ 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 + ┌─ tests/deprecated/deprecated_placement_module_members.move:36:11 │ 21 │ #[deprecated] │ ---------- Struct 'S' in module '0x41::N' deprecated here @@ -37,7 +37,7 @@ warning: Use of deprecated struct │ ^ 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 + ┌─ tests/deprecated/deprecated_placement_module_members.move:36:15 │ 2 │ #[deprecated] │ ---------- Module '0x42::M' deprecated here @@ -46,7 +46,7 @@ warning: Use of deprecated module │ ^ Use of deprecated module '0x42::M' warning: Use of deprecated function - ┌─ tests/more-v1/deprecated/deprecated_placement_module_members.move:36:18 + ┌─ tests/deprecated/deprecated_placement_module_members.move:36:18 │ 12 │ #[deprecated] │ ---------- Function 'foo' in module '0x42::M' deprecated here @@ -55,7 +55,7 @@ warning: Use of deprecated function │ ^^^ 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 + ┌─ tests/deprecated/deprecated_placement_module_members.move:37:2 │ 19 │ #[deprecated] │ ---------- Module '0x41::N' deprecated here @@ -64,7 +64,7 @@ warning: Use of deprecated module │ ^^^^^^^ Use of deprecated module '0x41::N' warning: Use of deprecated function - ┌─ tests/more-v1/deprecated/deprecated_placement_module_members.move:37:11 + ┌─ tests/deprecated/deprecated_placement_module_members.move:37:11 │ 27 │ #[deprecated] │ ---------- Function 'consume' in module '0x41::N' deprecated here 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/deprecated/deprecated_placement_module_members.move similarity index 100% rename from third_party/move/move-compiler-v2/tests/more-v1/deprecated/deprecated_placement_module_members.move rename to third_party/move/move-compiler-v2/tests/deprecated/deprecated_placement_module_members.move diff --git a/third_party/move/move-compiler-v2/tests/more-v1/deprecated/public_script.exp b/third_party/move/move-compiler-v2/tests/deprecated/public_script.exp similarity index 78% rename from third_party/move/move-compiler-v2/tests/more-v1/deprecated/public_script.exp rename to third_party/move/move-compiler-v2/tests/deprecated/public_script.exp index 511ecff116506..1463c4ca97cdf 100644 --- a/third_party/move/move-compiler-v2/tests/more-v1/deprecated/public_script.exp +++ b/third_party/move/move-compiler-v2/tests/deprecated/public_script.exp @@ -1,13 +1,13 @@ Diagnostics: warning: DEPRECATED. will be removed - ┌─ tests/more-v1/deprecated/public_script.move:2:5 + ┌─ tests/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 + ┌─ tests/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/deprecated/public_script.move similarity index 100% rename from third_party/move/move-compiler-v2/tests/more-v1/deprecated/public_script.move rename to third_party/move/move-compiler-v2/tests/deprecated/public_script.move diff --git a/third_party/move/move-compiler-v2/tests/testsuite.rs b/third_party/move/move-compiler-v2/tests/testsuite.rs index 8a95992d14204..e940d1aa6ab4e 100644 --- a/third_party/move/move-compiler-v2/tests/testsuite.rs +++ b/third_party/move/move-compiler-v2/tests/testsuite.rs @@ -198,26 +198,12 @@ const TEST_CONFIGS: Lazy> = Lazy::new(|| { dump_bytecode: DumpLevel::None, // do not dump anything dump_bytecode_filter: None, }, - // Tests for more-v1 tests - TestConfig { - name: "more-v1", - runner: |p| run_test(p, get_config_by_name("more-v1")), - include: vec!["/more-v1/"], - exclude: vec![], - exp_suffix: None, - options: opts.clone().set_experiment(Experiment::AST_SIMPLIFY, true), - // Run the entire compiler pipeline to double-check the result - stop_after: StopAfter::FileFormat, - dump_ast: DumpLevel::None, - dump_bytecode: DumpLevel::None, // do not dump anything - dump_bytecode_filter: None, - }, - // Tests for inlining, simplifier, and folding + // Tests for front-end, diagnostics (inlining, simplifier, folding, etc.) TestConfig { name: "inlining-et-al", runner: |p| run_test(p, get_config_by_name("inlining-et-al")), - include: vec!["/inlining/", "/folding/", "/simplifier/", "/more-v1/"], - exclude: vec!["/more-v1/verification/"], + include: vec!["/inlining/", "/folding/", "/simplifier/"], + exclude: vec![], exp_suffix: None, options: opts.clone().set_experiment(Experiment::AST_SIMPLIFY, true), // Run the entire compiler pipeline to double-check the result @@ -240,6 +226,20 @@ const TEST_CONFIGS: Lazy> = Lazy::new(|| { dump_bytecode: DumpLevel::None, // do not dump anything dump_bytecode_filter: None, }, + // Tests for diagnostics, where dumping AST isn't useful. + TestConfig { + name: "diagnostics", + runner: |p| run_test(p, get_config_by_name("diagnostics")), + include: vec!["/deprecated/"], + exclude: vec![], + exp_suffix: None, + options: opts.clone().set_experiment(Experiment::AST_SIMPLIFY, true), + // Run the entire compiler pipeline to double-check the result + stop_after: StopAfter::FileFormat, + dump_ast: DumpLevel::None, + dump_bytecode: DumpLevel::None, // do not dump anything + dump_bytecode_filter: None, + }, // --- Tests for bytecode generation TestConfig { name: "bytecode-gen", diff --git a/third_party/move/move-compiler-v2/tests/more-v1/verification/cross_module_valid.verification b/third_party/move/move-compiler-v2/tests/verification/cross_module_valid.verification similarity index 100% rename from third_party/move/move-compiler-v2/tests/more-v1/verification/cross_module_valid.verification rename to third_party/move/move-compiler-v2/tests/verification/cross_module_valid.verification diff --git a/third_party/move/move-compiler-v2/tests/more-v1/verification/double_annotation.verification b/third_party/move/move-compiler-v2/tests/verification/double_annotation.verification similarity index 100% rename from third_party/move/move-compiler-v2/tests/more-v1/verification/double_annotation.verification rename to third_party/move/move-compiler-v2/tests/verification/double_annotation.verification diff --git a/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/cross_module_invalid.exp b/third_party/move/move-compiler-v2/tests/verification/noverify/cross_module_invalid.exp similarity index 61% rename from third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/cross_module_invalid.exp rename to third_party/move/move-compiler-v2/tests/verification/noverify/cross_module_invalid.exp index 9ab00f7e922ff..ca9e9067e0ff9 100644 --- a/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/cross_module_invalid.exp +++ b/third_party/move/move-compiler-v2/tests/verification/noverify/cross_module_invalid.exp @@ -1,7 +1,7 @@ Diagnostics: error: unbound module - ┌─ tests/more-v1/verification/noverify/cross_module_invalid.move:23:9 + ┌─ tests/verification/noverify/cross_module_invalid.move:23:9 │ 23 │ A::build_foo() │ ^ Unbound module or type alias 'A' diff --git a/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/cross_module_invalid.move b/third_party/move/move-compiler-v2/tests/verification/noverify/cross_module_invalid.move similarity index 100% rename from third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/cross_module_invalid.move rename to third_party/move/move-compiler-v2/tests/verification/noverify/cross_module_invalid.move diff --git a/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/cross_module_valid.exp b/third_party/move/move-compiler-v2/tests/verification/noverify/cross_module_valid.exp similarity index 100% rename from third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/cross_module_valid.exp rename to third_party/move/move-compiler-v2/tests/verification/noverify/cross_module_valid.exp diff --git a/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/cross_module_valid.move b/third_party/move/move-compiler-v2/tests/verification/noverify/cross_module_valid.move similarity index 100% rename from third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/cross_module_valid.move rename to third_party/move/move-compiler-v2/tests/verification/noverify/cross_module_valid.move diff --git a/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/double_annotation.exp b/third_party/move/move-compiler-v2/tests/verification/noverify/double_annotation.exp similarity index 100% rename from third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/double_annotation.exp rename to third_party/move/move-compiler-v2/tests/verification/noverify/double_annotation.exp diff --git a/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/double_annotation.move b/third_party/move/move-compiler-v2/tests/verification/noverify/double_annotation.move similarity index 100% rename from third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/double_annotation.move rename to third_party/move/move-compiler-v2/tests/verification/noverify/double_annotation.move diff --git a/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/function_with_spec.exp b/third_party/move/move-compiler-v2/tests/verification/noverify/function_with_spec.exp similarity index 55% rename from third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/function_with_spec.exp rename to third_party/move/move-compiler-v2/tests/verification/noverify/function_with_spec.exp index db08d679d6f75..ea64cb0f09875 100644 --- a/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/function_with_spec.exp +++ b/third_party/move/move-compiler-v2/tests/verification/noverify/function_with_spec.exp @@ -1,7 +1,7 @@ Diagnostics: error: unresolved spec target - ┌─ tests/more-v1/verification/noverify/function_with_spec.move:15:10 + ┌─ tests/verification/noverify/function_with_spec.move:15:10 │ 15 │ spec baz { │ ^^^ diff --git a/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/function_with_spec.move b/third_party/move/move-compiler-v2/tests/verification/noverify/function_with_spec.move similarity index 100% rename from third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/function_with_spec.move rename to third_party/move/move-compiler-v2/tests/verification/noverify/function_with_spec.move diff --git a/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/single_module_invalid.exp b/third_party/move/move-compiler-v2/tests/verification/noverify/single_module_invalid.exp similarity index 57% rename from third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/single_module_invalid.exp rename to third_party/move/move-compiler-v2/tests/verification/noverify/single_module_invalid.exp index 8933693cbc7f7..232c3ee5c36c7 100644 --- a/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/single_module_invalid.exp +++ b/third_party/move/move-compiler-v2/tests/verification/noverify/single_module_invalid.exp @@ -1,19 +1,19 @@ Diagnostics: error: undeclared `0x1::M::Foo` - ┌─ tests/more-v1/verification/noverify/single_module_invalid.move:8:23 + ┌─ tests/verification/noverify/single_module_invalid.move:8:23 │ 8 │ public fun foo(): Foo { │ ^^^ error: undeclared struct `M::Foo` - ┌─ tests/more-v1/verification/noverify/single_module_invalid.move:9:9 + ┌─ tests/verification/noverify/single_module_invalid.move:9:9 │ 9 │ Foo {} │ ^^^ error: no function named `bar` found - ┌─ tests/more-v1/verification/noverify/single_module_invalid.move:17:24 + ┌─ tests/verification/noverify/single_module_invalid.move:17:24 │ 17 │ public fun baz() { bar() } │ ^^^^^ diff --git a/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/single_module_invalid.move b/third_party/move/move-compiler-v2/tests/verification/noverify/single_module_invalid.move similarity index 100% rename from third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/single_module_invalid.move rename to third_party/move/move-compiler-v2/tests/verification/noverify/single_module_invalid.move diff --git a/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/single_module_valid.exp b/third_party/move/move-compiler-v2/tests/verification/noverify/single_module_valid.exp similarity index 100% rename from third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/single_module_valid.exp rename to third_party/move/move-compiler-v2/tests/verification/noverify/single_module_valid.exp diff --git a/third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/single_module_valid.move b/third_party/move/move-compiler-v2/tests/verification/noverify/single_module_valid.move similarity index 100% rename from third_party/move/move-compiler-v2/tests/more-v1/verification/noverify/single_module_valid.move rename to third_party/move/move-compiler-v2/tests/verification/noverify/single_module_valid.move diff --git a/third_party/move/move-compiler-v2/tests/more-v1/verification/single_module_invalid.verification b/third_party/move/move-compiler-v2/tests/verification/single_module_invalid.verification similarity index 100% rename from third_party/move/move-compiler-v2/tests/more-v1/verification/single_module_invalid.verification rename to third_party/move/move-compiler-v2/tests/verification/single_module_invalid.verification diff --git a/third_party/move/move-compiler-v2/tests/more-v1/verification/single_module_valid.verification b/third_party/move/move-compiler-v2/tests/verification/single_module_valid.verification similarity index 100% rename from third_party/move/move-compiler-v2/tests/more-v1/verification/single_module_valid.verification rename to third_party/move/move-compiler-v2/tests/verification/single_module_valid.verification diff --git a/third_party/move/move-compiler-v2/tests/more-v1/verification/verify/cross_module_valid.exp b/third_party/move/move-compiler-v2/tests/verification/verify/cross_module_valid.exp similarity index 100% rename from third_party/move/move-compiler-v2/tests/more-v1/verification/verify/cross_module_valid.exp rename to third_party/move/move-compiler-v2/tests/verification/verify/cross_module_valid.exp diff --git a/third_party/move/move-compiler-v2/tests/more-v1/verification/verify/cross_module_valid.move b/third_party/move/move-compiler-v2/tests/verification/verify/cross_module_valid.move similarity index 100% rename from third_party/move/move-compiler-v2/tests/more-v1/verification/verify/cross_module_valid.move rename to third_party/move/move-compiler-v2/tests/verification/verify/cross_module_valid.move diff --git a/third_party/move/move-compiler-v2/tests/more-v1/verification/verify/double_annotation.exp b/third_party/move/move-compiler-v2/tests/verification/verify/double_annotation.exp similarity index 80% rename from third_party/move/move-compiler-v2/tests/more-v1/verification/verify/double_annotation.exp rename to third_party/move/move-compiler-v2/tests/verification/verify/double_annotation.exp index 141935281706e..fbc781f959cb2 100644 --- a/third_party/move/move-compiler-v2/tests/more-v1/verification/verify/double_annotation.exp +++ b/third_party/move/move-compiler-v2/tests/verification/verify/double_annotation.exp @@ -1,7 +1,7 @@ Diagnostics: error: duplicate declaration, item, or annotation - ┌─ tests/more-v1/verification/verify/double_annotation.move:8:7 + ┌─ tests/verification/verify/double_annotation.move:8:7 │ 7 │ #[verify_only] │ ----------- Attribute previously given here @@ -9,7 +9,7 @@ error: duplicate declaration, item, or annotation │ ^^^^^^^^^^^ Duplicate attribute 'verify_only' attached to the same item error: duplicate declaration, item, or annotation - ┌─ tests/more-v1/verification/verify/double_annotation.move:18:7 + ┌─ tests/verification/verify/double_annotation.move:18:7 │ 17 │ #[verify_only] │ ----------- Attribute previously given here diff --git a/third_party/move/move-compiler-v2/tests/more-v1/verification/verify/double_annotation.move b/third_party/move/move-compiler-v2/tests/verification/verify/double_annotation.move similarity index 100% rename from third_party/move/move-compiler-v2/tests/more-v1/verification/verify/double_annotation.move rename to third_party/move/move-compiler-v2/tests/verification/verify/double_annotation.move diff --git a/third_party/move/move-compiler-v2/tests/more-v1/verification/verify/function_with_spec.exp b/third_party/move/move-compiler-v2/tests/verification/verify/function_with_spec.exp similarity index 66% rename from third_party/move/move-compiler-v2/tests/more-v1/verification/verify/function_with_spec.exp rename to third_party/move/move-compiler-v2/tests/verification/verify/function_with_spec.exp index 81708f74de71f..47f7a09cccdad 100644 --- a/third_party/move/move-compiler-v2/tests/more-v1/verification/verify/function_with_spec.exp +++ b/third_party/move/move-compiler-v2/tests/verification/verify/function_with_spec.exp @@ -1,7 +1,7 @@ Diagnostics: error: unresolved spec target - ┌─ tests/more-v1/verification/verify/function_with_spec.move:15:10 + ┌─ tests/verification/verify/function_with_spec.move:15:10 │ 15 │ spec baz { │ ^^^ diff --git a/third_party/move/move-compiler-v2/tests/more-v1/verification/verify/function_with_spec.move b/third_party/move/move-compiler-v2/tests/verification/verify/function_with_spec.move similarity index 100% rename from third_party/move/move-compiler-v2/tests/more-v1/verification/verify/function_with_spec.move rename to third_party/move/move-compiler-v2/tests/verification/verify/function_with_spec.move diff --git a/third_party/move/move-compiler-v2/tests/more-v1/verification/verify/single_module_valid.exp b/third_party/move/move-compiler-v2/tests/verification/verify/single_module_valid.exp similarity index 100% rename from third_party/move/move-compiler-v2/tests/more-v1/verification/verify/single_module_valid.exp rename to third_party/move/move-compiler-v2/tests/verification/verify/single_module_valid.exp diff --git a/third_party/move/move-compiler-v2/tests/more-v1/verification/verify/single_module_valid.move b/third_party/move/move-compiler-v2/tests/verification/verify/single_module_valid.move similarity index 100% rename from third_party/move/move-compiler-v2/tests/more-v1/verification/verify/single_module_valid.move rename to third_party/move/move-compiler-v2/tests/verification/verify/single_module_valid.move