From 293f8294c3c88d160107fcc38a2a3c6e3069ae94 Mon Sep 17 00:00:00 2001 From: Teng Zhang Date: Tue, 5 Nov 2024 14:31:20 -0800 Subject: [PATCH] change feature gating for `_` to 2.1 --- .../move/move-compiler-v2/src/env_pipeline/inliner.rs | 2 +- third_party/move/move-model/src/builder/exp_builder.rs | 6 +++--- third_party/move/move-model/src/builder/module_builder.rs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/third_party/move/move-compiler-v2/src/env_pipeline/inliner.rs b/third_party/move/move-compiler-v2/src/env_pipeline/inliner.rs index 5502f1d9694f4..636f0d95d6728 100644 --- a/third_party/move/move-compiler-v2/src/env_pipeline/inliner.rs +++ b/third_party/move/move-compiler-v2/src/env_pipeline/inliner.rs @@ -834,7 +834,7 @@ impl<'env, 'rewriter> InlinedRewriter<'env, 'rewriter> { .map(|param| { let Parameter(sym, ty, loc) = *param; let id = env.new_node(loc.clone(), ty.instantiate(self.type_args)); - if env.language_version().is_at_least(LanguageVersion::V2_0) + if env.language_version().is_at_least(LanguageVersion::V2_1) && env.symbol_pool().string(*sym).as_ref() == "_" { Pattern::Wildcard(id) diff --git a/third_party/move/move-model/src/builder/exp_builder.rs b/third_party/move/move-model/src/builder/exp_builder.rs index 853d10cc27981..f47792adfd337 100644 --- a/third_party/move/move-model/src/builder/exp_builder.rs +++ b/third_party/move/move-model/src/builder/exp_builder.rs @@ -677,10 +677,10 @@ impl<'env, 'translator, 'module_translator> ExpTranslator<'env, 'translator, 'mo params: &[(PA::Var, EA::Type)], for_move_fun: bool, ) -> Vec { - let is_lang_version_2 = self + let is_lang_version_2_1 = self .env() .language_version - .is_at_least(LanguageVersion::V2_0); + .is_at_least(LanguageVersion::V2_1); params .iter() .enumerate() @@ -690,7 +690,7 @@ impl<'env, 'translator, 'module_translator> ExpTranslator<'env, 'translator, 'mo let sym = self.symbol_pool().make(var_str); let loc = self.to_loc(&v.loc()); - if !is_lang_version_2 || var_str != "_" { + if !is_lang_version_2_1 || var_str != "_" { self.define_local( &loc, sym, 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 ad2da753e48ce..2f28614bdcd86 100644 --- a/third_party/move/move-model/src/builder/module_builder.rs +++ b/third_party/move/move-model/src/builder/module_builder.rs @@ -1532,10 +1532,10 @@ impl<'env, 'translator> ModuleBuilder<'env, 'translator> { et.define_type_param(loc, *name, Type::new_param(pos), kind.clone(), false); } et.enter_scope(); - let is_lang_version_2 = et.env().language_version.is_at_least(LanguageVersion::V2_0); + let is_lang_version_2_1 = et.env().language_version.is_at_least(LanguageVersion::V2_1); for (idx, Parameter(n, ty, loc)) in params.iter().enumerate() { let symbol_pool = et.parent.parent.env.symbol_pool(); - if !is_lang_version_2 || symbol_pool.string(*n).as_ref() != "_" { + if !is_lang_version_2_1 || symbol_pool.string(*n).as_ref() != "_" { et.define_local(loc, *n, ty.clone(), None, Some(idx)); } }