diff --git a/external-crates/move/crates/move-analyzer/src/analysis/typing_analysis.rs b/external-crates/move/crates/move-analyzer/src/analysis/typing_analysis.rs index 98681fb9f2d6b9..643cc3b09d98c7 100644 --- a/external-crates/move/crates/move-analyzer/src/analysis/typing_analysis.rs +++ b/external-crates/move/crates/move-analyzer/src/analysis/typing_analysis.rs @@ -551,13 +551,15 @@ impl TypingAnalysisContext<'_> { self.add_variant_use_def(mident, name, vname); tyargs.iter_mut().for_each(|t| self.visit_type(None, t)); for (fpos, fname, (_, (_, pat))) in fields.iter_mut() { - self.add_variant_field_use_def( - &mident.value, - &name.value(), - &vname.value(), - fname, - &fpos, - ); + if self.compiler_info.ellipsis_binders.get(&fpos).is_none() { + self.add_variant_field_use_def( + &mident.value, + &name.value(), + &vname.value(), + fname, + &fpos, + ); + } self.process_match_patterm(pat); } } @@ -566,7 +568,9 @@ impl TypingAnalysisContext<'_> { self.add_datatype_use_def(mident, name); tyargs.iter_mut().for_each(|t| self.visit_type(None, t)); for (fpos, fname, (_, (_, pat))) in fields.iter_mut() { - self.add_struct_field_use_def(&mident.value, &name.value(), fname, &fpos); + if self.compiler_info.ellipsis_binders.get(&fpos).is_none() { + self.add_struct_field_use_def(&mident.value, &name.value(), fname, &fpos); + } self.process_match_patterm(pat); } } @@ -998,14 +1002,7 @@ impl<'a> TypingVisitorContext for TypingAnalysisContext<'a> { .for_each(|t| visitor.visit_type(Some(exp_loc), t)); true } - TE::VariantMatch(e, (mident, enum_name), v) => { - // visitor.visit_exp(e); - // visitor.add_datatype_use_def(mident, enum_name); - // v.iter_mut().for_each(|(vname, e)| { - // visitor.add_variant_use_def(mident, enum_name, vname); - // visitor.visit_exp(e); - // }); - + TE::VariantMatch(..) => { // These should not be available before match compilation. debug_assert!(false); true diff --git a/external-crates/move/crates/move-analyzer/src/compiler_info.rs b/external-crates/move/crates/move-analyzer/src/compiler_info.rs index b9a22ee589c9dc..32cdfd26993b96 100644 --- a/external-crates/move/crates/move-analyzer/src/compiler_info.rs +++ b/external-crates/move/crates/move-analyzer/src/compiler_info.rs @@ -12,6 +12,9 @@ pub struct CompilerInfo { pub macro_info: BTreeMap, pub expanded_lambdas: BTreeSet, pub autocomplete_info: BTreeMap>, + /// Locations of binders in enum variants that are expanded from an ellipsis (and should + /// not be displayed in any way by the IDE) + pub ellipsis_binders: BTreeSet, } impl CompilerInfo { @@ -54,7 +57,7 @@ impl CompilerInfo { // TODO: Not much to do with this yet. } CI::IDEAnnotation::EllipsisMatchEntries(_) => { - // TODO: Not much to do with this yet. + self.ellipsis_binders.insert(loc); } } }