Skip to content

Commit

Permalink
Added suppression of ellipsis binders display
Browse files Browse the repository at this point in the history
  • Loading branch information
awelc committed Jun 24, 2024
1 parent 489450f commit e3da994
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand All @@ -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);
}
}
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ pub struct CompilerInfo {
pub macro_info: BTreeMap<Loc, CI::MacroCallInfo>,
pub expanded_lambdas: BTreeSet<Loc>,
pub autocomplete_info: BTreeMap<FileHash, BTreeMap<Loc, CI::AutocompleteInfo>>,
/// 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<Loc>,
}

impl CompilerInfo {
Expand Down Expand Up @@ -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);
}
}
}
Expand Down

0 comments on commit e3da994

Please sign in to comment.