diff --git a/crates/aptos/src/governance/mod.rs b/crates/aptos/src/governance/mod.rs index 237216713f641b..d43ff9bd443d7a 100644 --- a/crates/aptos/src/governance/mod.rs +++ b/crates/aptos/src/governance/mod.rs @@ -983,8 +983,10 @@ impl CompileScriptFunction { &self.framework_package_args, prompt_options, self.bytecode_version, - self.language_version, - self.compiler_version, + self.language_version + .or_else(|| Some(LanguageVersion::latest_stable())), + self.compiler_version + .or_else(|| Some(CompilerVersion::latest_stable())), ) } } diff --git a/crates/aptos/src/move_tool/coverage.rs b/crates/aptos/src/move_tool/coverage.rs index 366b6bb9472f9c..4a04b62bd9d15e 100644 --- a/crates/aptos/src/move_tool/coverage.rs +++ b/crates/aptos/src/move_tool/coverage.rs @@ -16,6 +16,7 @@ use move_coverage::{ summary::summarize_inst_cov, }; use move_disassembler::disassembler::Disassembler; +use move_model::metadata::{CompilerVersion, LanguageVersion}; use move_package::{compilation::compiled_package::CompiledPackage, BuildConfig, CompilerConfig}; /// Display a coverage summary for all modules in a package @@ -175,8 +176,12 @@ fn compile_coverage( move_options.bytecode_version, move_options.language_version, ), - compiler_version: move_options.compiler_version, - language_version: move_options.language_version, + compiler_version: move_options + .compiler_version + .or_else(|| Some(CompilerVersion::latest_stable())), + language_version: move_options + .language_version + .or_else(|| Some(LanguageVersion::latest_stable())), experiments: experiments_from_opt_level(&move_options.optimize), }, ..Default::default() diff --git a/crates/aptos/src/move_tool/mod.rs b/crates/aptos/src/move_tool/mod.rs index fcfe3c0ababe22..e4c09a4b80c4ac 100644 --- a/crates/aptos/src/move_tool/mod.rs +++ b/crates/aptos/src/move_tool/mod.rs @@ -564,8 +564,14 @@ impl CliCommand<&'static str> for TestPackage { self.move_options.bytecode_version, self.move_options.language_version, ), - compiler_version: self.move_options.compiler_version, - language_version: self.move_options.language_version, + compiler_version: self + .move_options + .compiler_version + .or_else(|| Some(CompilerVersion::latest_stable())), + language_version: self + .move_options + .language_version + .or_else(|| Some(LanguageVersion::latest_stable())), experiments: experiments_from_opt_level(&self.move_options.optimize), }, ..Default::default() @@ -717,8 +723,12 @@ impl CliCommand<&'static str> for DocumentPackage { move_options.bytecode_version, move_options.language_version, ), - compiler_version: move_options.compiler_version, - language_version: move_options.language_version, + compiler_version: move_options + .compiler_version + .or_else(|| Some(CompilerVersion::latest_stable())), + language_version: move_options + .language_version + .or_else(|| Some(LanguageVersion::latest_stable())), skip_attribute_checks: move_options.skip_attribute_checks, check_test_code: move_options.check_test_code, known_attributes: extended_checks::get_all_attribute_names().clone(), @@ -900,8 +910,12 @@ impl IncludedArtifacts { let override_std = move_options.override_std.clone(); let bytecode_version = fix_bytecode_version(move_options.bytecode_version, move_options.language_version); - let compiler_version = move_options.compiler_version; - let language_version = move_options.language_version; + let compiler_version = move_options + .compiler_version + .or_else(|| Some(CompilerVersion::latest_stable())); + let language_version = move_options + .language_version + .or_else(|| Some(LanguageVersion::latest_stable())); let skip_attribute_checks = move_options.skip_attribute_checks; let check_test_code = move_options.check_test_code; let optimize = move_options.optimize.clone(); @@ -910,8 +924,10 @@ impl IncludedArtifacts { experiments.append(&mut more_experiments); if matches!( - move_options.compiler_version, - Option::None | Some(CompilerVersion::V1) + move_options + .compiler_version + .or_else(|| Some(CompilerVersion::latest_stable())), + Some(CompilerVersion::V1) ) { if !matches!(optimize, Option::None | Some(OptimizationLevel::Default)) { return Err(CliError::CommandArgumentError(